Repository navigation
Fix 251 - #254
Merged
Merged
Fix 251#254
Conversation
… the rule (crossbario#251) - _BatchedCall.cancel() (_common.py): a real bug. cancel() set _timer to None, so a second cancel() raised AttributeError. It is now a no-op, as asyncio's Handle.cancel() is. - make_logger() (aio.py and tx.py, 12 sites): the same caller-frame lookup, duplicated in both. It is now one helper, _common._caller_namespace(), which raises a clear RuntimeError when there is no caller frame (inspect.currentframe() is None on a Python without stack frames) instead of an AttributeError on None. On CPython and PyPy the namespaces are unchanged. - _log() (aio.py): `_categories.get(key)` right after `key in _categories` cannot be None; `_categories[key]` says so, same behaviour. - check-typing: --ignore missing-union-attribute removed. The issue had two locations swapped: the cancel() site is _common.py:46, the format one aio.py:170. tests/test_issue_251.py: cancel twice; the namespace from a function and from a method; no stack frames gives the RuntimeError; make_logger()'s namespace on Twisted and on asyncio. Checked with ty 0.0.100 (the newest): check-format, check-lint and check-typing pass. The test suite, 111 passed and 10 skipped, on CPython 3.11, CPython 3.14 and PyPy 3.11, each against this source. With the cancel() fix reverted, the new test fails with AttributeError and check-typing reports the site again. Note: This work was completed with AI assistance (Claude Code).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #251