contextvars.Context doesn't inherit from Mapping#12873
contextvars.Context doesn't inherit from Mapping#12873tungol wants to merge 1 commit intopython:mainfrom
Conversation
|
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
|
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.
|
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 |
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+ |
|
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.