Skip to content

Conversation

@vstinner
Copy link
Member

@vstinner vstinner commented Jul 30, 2024

PyObject_Del() is just a alias to PyObject_Free() kept for backward compatibility. Use directly PyObject_Free() instead.


📚 Documentation preview 📚: https://cpython-previews--122453.org.readthedocs.build/

PyObject_Del() is just a alias to PyObject_Free() kept for backward
compatibility. Use directly PyObject_Free() instead.
@vstinner vstinner merged commit fda6bd8 into python:main Aug 1, 2024
@vstinner vstinner deleted the pyobject_free branch August 1, 2024 12:12
@lazka
Copy link
Contributor

lazka commented Aug 1, 2024

This is an improvement, but now the docs are inconsistent/contradicting:

  • tp_dealloc docs say that PyObject_Free() should be used after PyObject_New() for example. PyObject_Free() docs states that this is undefined behavior.
  • PyObject_Del() docs say that is should be called from tp_dealloc, while tp_dealloc docs say PyObject_Free() should be called.

@vstinner
Copy link
Member Author

vstinner commented Aug 2, 2024

I wrote a follow-up PR to update the doc: #122597

blhsing pushed a commit to blhsing/cpython that referenced this pull request Aug 22, 2024
PyObject_Del() is just a alias to PyObject_Free() kept for backward
compatibility. Use directly PyObject_Free() instead.
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.

2 participants