Skip to content

Conversation

@vstinner
Copy link
Member

@vstinner vstinner commented Apr 4, 2020

The PyObject_NEW() macro becomes an alias to the PyObject_New()
macro, and the PyObject_NEW_VAR() macro becomes an alias to the
PyObject_NewVar() macro, to hide implementation details. They no
longer access directly the PyTypeObject.tp_basicsize member.

https://bugs.python.org/issue40170

@vstinner
Copy link
Member Author

vstinner commented Apr 4, 2020

Once this PR is merged, I plan to write following PR to remove _PyObject_SIZE() and the example using it.

Copy link
Member

@corona10 corona10 left a comment

Choose a reason for hiding this comment

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

Looks good to me, Victor

@vstinner
Copy link
Member Author

vstinner commented Apr 7, 2020

Previously, PyObject_NEW() macro already called PyObject_Init() function. It now calls _PyObject_New() which calls the inlined flavor PyObject_INIT(). I don't expect any impact on performance.

The PyObject_NEW() macro becomes an alias to the PyObject_New()
macro, and the PyObject_NEW_VAR() macro becomes an alias to the
PyObject_NewVar() macro, to hide implementation details. They no
longer access directly the PyTypeObject.tp_basicsize member.

Move _PyObject_SIZE() and _PyObject_VAR_SIZE() macros to the
CPython-specific C API (Include/cpython/).

Replace PyObject_NEW() with PyObject_New() and replace
PyObject_NEW_VAR() with PyObject_NewVar().
@vstinner vstinner requested a review from a team as a code owner April 7, 2020 22:15
@vstinner vstinner changed the title bpo-40170: PyObject_NEW() now calls _PyObject_New() bpo-40170: PyObject_NEW() becomes an alias to PyObject_New() Apr 7, 2020
@vstinner vstinner merged commit 9205520 into python:master Apr 7, 2020
@vstinner vstinner deleted the pyobject_new branch April 7, 2020 22:38
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.

4 participants