Uh oh!
There was an error while loading. Please reload this page.
contextvars.Context doesn't inherit from Mapping - #12873
Conversation
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
AlexWaygood
commented
Oct 22, 2024
That's kind of interesting that we don't do the |
srittau
left a comment
There was a problem hiding this comment.
Interesting, but the primer hits are encouraging.
tungol
commented
Oct 22, 2024
Yeah, I was wondering if maybe the right thing to do here was add the registration to cpython? I haven't looked at them in detail yet, but two others in a somewhat similar boat are |
AlexWaygood
commented
Oct 22, 2024
Very possibly. In theory of course, we could do this change and the CPython change, though it might lead to some annoying branching in the stubs if the CPython change is only accepted for Python 3.14+ |
tungol
commented
Nov 6, 2024
This is now fixed in cpython for 3.12 and up. It probably doesn't make sense to branch for the sake of 3.8 to 3.11. |
It's not a subclass, it's not registered to Mapping, and Mapping isn't protocol-like, so at runtime:
It does have all the necessary methods to be Mapping, it just isn't.