Repository navigation
Conversation
|
Windows verification for gh-162703, with AI assistance from Codex. Environment: Windows 11 25H2, build 26200.9974, AMD64; CPython 3.13.14 (MSC v.1944, Microsoft Store distribution). The reported stale-dispatch behavior reproduced in 100/100 independent trials: after warming the fallback and calling A local copy of 3.13.14's for arg in get_args(cls):
registry[arg] = func
+ if cache_token is None and hasattr(arg, '__abstractmethods__'):
+ cache_token = get_cache_token()Results:
This supports the per-union-member cache-token approach in this PR, but does not claim verification of PR head a831a8c on main: the tested implementation is a small 3.13.14 adaptation. The complete CPython test suite was not run, and the installed standard library was not modified. Credit to the issue reporter and @Woojay44 for the existing report and proposal. Codex prepared the local patch/tests, executed the checks, and drafted this report; this is additional Windows evidence, not a new discovery or a merge-readiness claim. |
When an ABC is registered with
singledispatchas part of a union(e.g.
@f.register(A | bytes)),register()checked__abstractmethods__on the union object itself instead of its members. As a result the ABC
cache token was never set up, and the dispatch cache was not cleared after
A.register(B), sof(B())kept returning the stale default handler.register()now checks every member of the union, the same way it alreadydoes for a single class. A regression test is added to
test_functools.