From 52b61aada3272fce42757ad34ba105415c346a01 Mon Sep 17 00:00:00 2001 From: Jacqueline Garrahan Date: Tue, 14 Jul 2026 14:57:32 -0700 Subject: [PATCH] client/asyncio: break after subscription completion to avoid pop() on None After a subscription completed, _handle set self._S = None but fell through into the enclosing `while self._run:` loop (unlike the cothread client, which breaks). The next iteration ran `S = self._S` (None) then `S.pop()` -> AttributeError, caught by the bare except and logged as "Error processing Subscription event" with a traceback on every normal monitor completion. Data was delivered correctly, but each finishing monitor emitted a spurious error. Break out of the loop after handling completion. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/p4p/client/asyncio.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/p4p/client/asyncio.py b/src/p4p/client/asyncio.py index 74aeb2ed..5089401d 100644 --- a/src/p4p/client/asyncio.py +++ b/src/p4p/client/asyncio.py @@ -401,6 +401,7 @@ async def _handle(self): if self._notify_disconnect: E = Finished() await self._cb(E) + break # queue drained; do not loop back and pop() from None except asyncio.CancelledError: