FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Question re PyObject_Del() being converted to PyObject_Free() · Issue #103 · python/pythoncapi-compat · GitHub

Repository navigation

Question re PyObject_Del() being converted to PyObject_Free() #103

Description

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.

Activity

vstinner commented on Jul 29, 2024

Member

PyObject_Del() is just a deprecated alias to PyObject_Free():

#define PyObject_Del PyObject_Free

src: https://github.com/python/cpython/blob/3b034d26eb8480f8d12ae11f42d038d24cf8498a/Include/objimpl.h#L107

I agree that it's confusing :-)

lazka commented on Jul 29, 2024

ContributorAuthor

I see, so it's just outdated documentation.

Should I move this to CPython?

lazka commented on Jul 29, 2024

ContributorAuthor

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?

vstinner commented on Jul 30, 2024

Member

It's just deprecated in a comment, nothing more. Maybe the upgrade script should leave them unchanged.

vstinner commented on Jul 30, 2024

Member

I wrote python/cpython#122453 for Python.

lazka commented on Aug 2, 2024

ContributorAuthor

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL