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
Replace Py_INCREF()/Py_XINCREF() usage with Py_NewRef()/Py_XNewRef() #99300
Labels
type-bug
An unexpected behavior, bug, or error
Comments
vstinner
added a commit
to vstinner/cpython
that referenced
this issue
Nov 9, 2022
Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and Py_XNewRef() in C files of the Python/ directory.
vstinner
added a commit
to vstinner/cpython
that referenced
this issue
Nov 9, 2022
Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and Py_XNewRef() in C files of the Python/ directory.
vstinner
added a commit
to vstinner/cpython
that referenced
this issue
Nov 9, 2022
Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and Py_XNewRef() in C files of the Python/ directory.
vstinner
added a commit
that referenced
this issue
Nov 10, 2022
Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and Py_XNewRef() in C files of the Python/ directory.
vstinner
added a commit
to vstinner/cpython
that referenced
this issue
Nov 10, 2022
Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and Py_XNewRef() in C files of the Python/ directory.
vstinner
added a commit
to vstinner/cpython
that referenced
this issue
Nov 10, 2022
Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and Py_XNewRef() in C files of the Python/ directory.
vstinner
added a commit
to vstinner/cpython
that referenced
this issue
Nov 10, 2022
Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and Py_XNewRef() in C files of the Python/ directory.
vstinner
added a commit
to vstinner/cpython
that referenced
this issue
Nov 10, 2022
Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and Py_XNewRef() in C files of the Python/ directory. Update Parser/asdl_c.py to regenerate Python/Python-ast.c.
vstinner
added a commit
to vstinner/cpython
that referenced
this issue
Nov 10, 2022
Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and Py_XNewRef() in Python/ceval.c and related files.
vstinner
added a commit
to vstinner/cpython
that referenced
this issue
Nov 10, 2022
Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and Py_XNewRef() in Python/ceval.c and related files.
vstinner
added a commit
that referenced
this issue
Nov 10, 2022
Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and Py_XNewRef() in C files of the Python/ directory. Update Parser/asdl_c.py to regenerate Python/Python-ast.c.
vstinner
added a commit
that referenced
this issue
Nov 10, 2022
Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and Py_XNewRef() in Python/ceval.c and related files.
vstinner
added a commit
to vstinner/cpython
that referenced
this issue
Nov 10, 2022
Replace Py_INCREF() with Py_NewRef() in C files of the Parser/ directory and in the PEG generator.
vstinner
added a commit
that referenced
this issue
Nov 10, 2022
Replace Py_INCREF() with Py_NewRef() in C files of the Parser/ directory and in the PEG generator.
vstinner
added a commit
to vstinner/cpython
that referenced
this issue
Nov 10, 2022
Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and Py_XNewRef() in C files of the Objects/ directory.
vstinner
added a commit
to vstinner/cpython
that referenced
this issue
Nov 10, 2022
Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and Py_XNewRef() in C files of the Objects/ directory.
vstinner
added a commit
to vstinner/cpython
that referenced
this issue
Nov 10, 2022
Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and Py_XNewRef() in Objects/dictobject.c.
vstinner
added a commit
to vstinner/cpython
that referenced
this issue
Nov 10, 2022
Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and Py_XNewRef() in Objects/dictobject.c.
vstinner
added a commit
to vstinner/cpython
that referenced
this issue
Nov 10, 2022
Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and Py_XNewRef() in C files of the Objects/ directory.
vstinner
added a commit
to vstinner/cpython
that referenced
this issue
Nov 10, 2022
Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and Py_XNewRef() in C files of the Objects/ directory.
vstinner
added a commit
to vstinner/cpython
that referenced
this issue
Nov 10, 2022
Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and Py_XNewRef() in Objects/listobject.c.
vstinner
added a commit
that referenced
this issue
Nov 10, 2022
Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and Py_XNewRef() in Objects/dictobject.c.
vstinner
added a commit
that referenced
this issue
Nov 10, 2022
Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and Py_XNewRef() in C files of the Objects/ directory.
gvanrossum
pushed a commit
to gvanrossum/cpython
that referenced
this issue
Nov 10, 2022
Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and Py_XNewRef() in C files of the Objects/ directory.
gvanrossum
pushed a commit
to gvanrossum/cpython
that referenced
this issue
Nov 10, 2022
Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and Py_XNewRef() in Objects/dictobject.c.
vstinner
added a commit
that referenced
this issue
Nov 10, 2022
Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and Py_XNewRef() in Objects/listobject.c.
vstinner
added a commit
that referenced
this issue
Nov 10, 2022
Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and Py_XNewRef() in C files of the Objects/ directory.
vstinner
added a commit
to vstinner/cpython
that referenced
this issue
Nov 10, 2022
Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and Py_XNewRef() in C files of the Objects/ directory.
vstinner
added a commit
to vstinner/cpython
that referenced
this issue
Nov 10, 2022
Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and Py_XNewRef() in C files of the Objects/ directory.
vstinner
added a commit
to vstinner/cpython
that referenced
this issue
Nov 10, 2022
Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and Py_XNewRef() in C files of the Objects/ directory.
vstinner
added a commit
to vstinner/cpython
that referenced
this issue
Nov 10, 2022
Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and Py_XNewRef() in C files of the Objects/ directory.
vstinner
added a commit
to vstinner/cpython
that referenced
this issue
Nov 10, 2022
Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and Py_XNewRef() in C files of the Objects/ directory.
vstinner
added a commit
that referenced
this issue
Nov 10, 2022
Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and Py_XNewRef() in C files of the Objects/ directory.
vstinner
added a commit
that referenced
this issue
Nov 10, 2022
Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and Py_XNewRef() in C files of the Objects/ directory.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
vstinner commentedNov 9, 2022
•
edited by bedevere-bot
I added Py_NewRef() and Py_XNewRef() to Python 3.10 C API. IMO using them make to code easier to read and make the code looks "more correct". Examples:
(A) Assign + INCREF:
(B) INCREF + assign:
(C) INCREF + return:
While technically, Py_INCREF() and Py_XINCREF() modify the object in-place (increment their reference counter), for me Py_NewRef() makes me sense: it creates "a new reference".
The example (A) is weird: it assigns a variable to something, and only later creates a new reference. For me, the syntax with Py_NewRef() makes more sense.
Examples (B) and (C) are shorter with Py_NewRef(), and again, IMO makes more sense and are more readable.
The text was updated successfully, but these errors were encountered: