-
-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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
Inaccurate emulation of _PyType_Lookup() in the Descriptor HOWTO #95822
Labels
docs
Documentation in the Doc dir
Comments
Thanks for the bug report. Here's a proposed update that replaces
Also, I want to add tests to cover your example and to cover why the fix proposed in the PR was incorrect. |
rhettinger
changed the title
Doc: descriptior HOWTO bad example
Inaccurate emulation of _PyType_Lookup() in the Descriptor HOWTO
Aug 10, 2022
rhettinger
added a commit
to rhettinger/cpython
that referenced
this issue
Aug 13, 2022
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this issue
Aug 19, 2022
…lent. (pythonGH-95967) (cherry picked from commit 6740680) Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
rhettinger
added a commit
that referenced
this issue
Aug 19, 2022
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this issue
Aug 19, 2022
…lent. (pythonGH-95967) (cherry picked from commit 6740680) Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
rhettinger
pushed a commit
that referenced
this issue
Aug 19, 2022
rhettinger
pushed a commit
that referenced
this issue
Aug 19, 2022
Thanks for the report. This is fixed now. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Documentation
Doc link: https://docs.python.org/3.10/howto/descriptor.html#invocation-from-an-instance
Source: https://github.com/python/cpython/blame/eb81c1aea16914347919745e843c982ed831a9fb/Doc/howto/descriptor.rst#L585-L601
The code example is bad at https://github.com/python/cpython/blame/eb81c1aea16914347919745e843c982ed831a9fb/Doc/howto/descriptor.rst#L589
getattr(objtype, name)
will go throughdescriptor.__get__
.Code Snippet:
Solution
Using
__dict__
(or vars) instead ofgetattr
:The text was updated successfully, but these errors were encountered: