-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
Document that PyType_GetModuleByDef returns a borrowed reference #135666
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
Conversation
@@ -282,6 +282,10 @@ Type Objects | |||
and other places where a method's defining class cannot be passed using the | |||
:c:type:`PyCMethod` calling convention. | |||
The returned reference is :term:`borrowed <borrowed reference>` from *type*, | |||
and will be valid as long as you hold a reference to *type*. | |||
Do not release it with :c:func:`Py_DECREF` or similar. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer L287 to have "otherwise" or something if hold a reference
implies a Py_INCREF()
in the previous line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I completely misread that, mixing the module and the type. LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries. Thanks for checking!
Thanks @encukou for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14. |
…honGH-135666) (cherry picked from commit 140731ff671395fb7a869c2784429c14dc83fb27) Co-authored-by: Petr Viktorin <encukou@gmail.com>
GH-135701 is a backport of this pull request to the 3.14 branch. |
…honGH-135666) (cherry picked from commit 140731f) Co-authored-by: Petr Viktorin <encukou@gmail.com>
GH-135702 is a backport of this pull request to the 3.13 branch. |
📚 Documentation preview 📚: https://cpython-previews--135666.org.readthedocs.build/