Closed lazka closed 3 months ago
PyObject_Del() is just a deprecated alias to PyObject_Free():
#define PyObject_Del PyObject_Free
I agree that it's confusing :-)
I see, so it's just outdated documentation.
Should I move this to CPython?
Hm, PyObject_Del is used all over the place in the docs, and in CPython source, with no indication that it is deprecated besides that one inline comment. So I'm wondering if it really is deprecated at all?
It's just deprecated in a comment, nothing more. Maybe the upgrade script should leave them unchanged.
I wrote https://github.com/python/cpython/pull/122453 for Python.
Thanks!
The upgrade script replaces the following call to PyObject_Del() with PyObject_Free() here: https://github.com/pygobject/pycairo/blob/ce6118526606f93d3132f881bf548ce746b782fe/cairo/path.c#L242 and it seems deliberate (??)
PyObject_Del() is documented to be used for PyObject_New() or PyObject_NewVar(), while PyObject_Free() is documented to be used for PyObject_Malloc(), PyObject_Realloc() or PyObject_Calloc(), otherwise it is undefined behavior.
I'm a bit confused by this.