From 84446f5ad8f273d282ab72bc16b6982269d661ee Mon Sep 17 00:00:00 2001 From: Luka Aladashvili <115102487+llukito@users.noreply.github.com> Date: Tue, 10 Feb 2026 17:08:39 +0400 Subject: [PATCH] refactor: replace bare except with BaseException in AsyncQueue (#6765) ## Description Replaced a bare `except:` with `except BaseException:` in `libs/langgraph/langgraph/_internal/_queue.py`. ## Motivation Using a bare `except:` violates PEP 8 (E722). While functionally equivalent to `except BaseException:`, making it explicit improves code readability and satisfies static analysis tools. This ensures that `asyncio.CancelledError` (which inherits from `BaseException`) is still caught and handled correctly by the cancellation logic in the `wait()` method, but without the ambiguity of a bare except. --- libs/langgraph/langgraph/_internal/_queue.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/langgraph/langgraph/_internal/_queue.py b/libs/langgraph/langgraph/_internal/_queue.py index a7e48c486..b2cc02a77 100644 --- a/libs/langgraph/langgraph/_internal/_queue.py +++ b/libs/langgraph/langgraph/_internal/_queue.py @@ -25,7 +25,7 @@ class AsyncQueue(asyncio.Queue): self._getters.append(getter) try: await getter - except: + except BaseException: getter.cancel() # Just in case getter is not done yet. try: # Clean self._getters from canceled getters.