Skip to content
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

Trivial: Fix typo in Py_DECREF comment #128387

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jkrejcha
Copy link

@jkrejcha jkrejcha commented Dec 31, 2024

Py_DECREF's comment incorrectly references _Py_IncRef which isn't used by decref. Both functions don't accept NULL but only _Py_DecRef is relevant for the decref function

Copy link

cpython-cla-bot bot commented Dec 31, 2024

All commit authors signed the Contributor License Agreement.
CLA signed

@bedevere-app
Copy link

bedevere-app bot commented Dec 31, 2024

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

Copy link
Contributor

@StanFromIreland StanFromIreland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why change a comment that is wrong to one that is also wrong?

This is explained in a previous comment in the file:
If it may be NULL, use Py_XINCREF/Py_XDECREF instead.

I think this comment should be completely changed or removed.

@picnixz
Copy link
Contributor

picnixz commented Jan 1, 2025

The comment is more for internal purposes and implementation details explaining why we are using _Py_DecRef instead of Py_DecRef and for compatibility reasons.

The caller is not meant to pass NULL when using Py_DECREF at all, but the implementation may appear to allow it (at least until Python 3.10).

@jkrejcha
Copy link
Author

jkrejcha commented Jan 2, 2025

Indeed this appears to me to be the case. Py_DecRef (notably not Py_DECREF) is just be a thin wrapper around Py_XDECREF.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants