[DRAFT] gh-105059: In C++, Py_INCREF() uses a function call by vstinner · Pull Request #105764 · python/cpython · GitHub
Skip to content

[DRAFT] gh-105059: In C++, Py_INCREF() uses a function call - #105764

Closed
vstinner wants to merge 1 commit into
python:mainfrom
vstinner:incref_cpp
Closed

vstinner wants to merge 1 commit into
python:mainfrom
vstinner:incref_cpp

Conversation

@vstinner

@vstinner vstinner commented Jun 14, 2023

Copy link
Copy Markdown
Member

In C++, Py_INCREF() and Py_DECREF() are now implemented as function calls. Moreover, in C++, PyObject.ob_refcnt type is just Py_ssize_t: don't use an anonymous union to avoid compiler warnings (anonymous unions were added to C11).

In C++, Py_INCREF() and Py_DECREF() are now implemented as function
calls. Moreover, in C++, PyObject.ob_refcnt type is just Py_ssize_t:
don't use an anonymous union to avoid compiler warnings (anonymous
unions were added to C11).
@vstinner

Copy link
Copy Markdown
Member Author

@vstinner

Copy link
Copy Markdown
Member Author

C without anonymous union (ex: ISO C89)

C compiler configured for C99 in pedantic mode also emits a compiler warning (which may be treated as error) in Include/object.h because of the PyObject.ob_refcnt anonymous union: #105059 (comment)

@vstinner

Copy link
Copy Markdown
Member Author

@vstinner vstinner closed this Jun 14, 2023
@vstinner
vstinner deleted the incref_cpp branch June 14, 2023 02:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant