New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
contextlib.ContextManager doesn't contain __slots__ = ()
#105726
Labels
type-bug
An unexpected behavior, bug, or error
Comments
|
Indeed, can you open a PR for that? |
|
@sunmy2019 |
|
Changes like this are considered new features. So |
grigoriev-semyon
added a commit
to grigoriev-semyon/cpython
that referenced
this issue
Jul 15, 2023
grigoriev-semyon
added a commit
to grigoriev-semyon/cpython
that referenced
this issue
Jul 15, 2023
kumaraditya303
added a commit
that referenced
this issue
Jul 16, 2023
…syncContextManager` (#106771) Co-authored-by: Kumar Aditya <kumaraditya@python.org>
|
@grigoriev-semyon thank you! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment


Python's ABCs should have
__slots__attributes to not interfere with slotting in derived classes (especially when the class has no members). However, it is not the case forcontextlib.ContextManager(as for othercontextlibABCs):Changing
ContextManagertoMutableMapping, for example (and setting relevant dunders), does raise an exception.Observed on Ubuntu 20.04 and Python 3.9.16.
Linked PRs
__slots__toAbstractContextManagerandAbstractAsyncContextManager#106771The text was updated successfully, but these errors were encountered: