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

Replace PyObject_Del with PyObject_Free #122453

Merged
merged 1 commit into from
Aug 1, 2024
Merged

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
57 checks passed
@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