GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [C API] Add _Py_NewImmortalRef() function to the internal C API · Issue #124074 · python/cpython

[C API] Add _Py_NewImmortalRef() function to the internal C API #124074

New issue
Copy link
New issue
Copy link
Closed
Closed
[C API] Add _Py_NewImmortalRef() function to the internal C API#124074
Copy link
Labels
topic-C-APItype-featureA feature request or enhancementA feature request or enhancement

Description

@vstinner
vstinner
opened on Sep 13, 2024
Issue body actions

I propose adding the following static inline function to the internal C API:

static inline PyObject* _Py_NewImmortalRef(PyObject *obj)
{
    assert(_Py_IsImmortalLoose(obj));
    return obj;
}

It's a way to annotate the code to express that a strong reference is expected, but we also know that the object is immortal and so calling Py_INCREF() is not needed.

See also #103906 and #123972.

Linked PRs

  • gh-124074: Add _Py_NewImmortalRef() function #124076

Activity

  1. vstinner
    added
    topic-C-API
    on Sep 13, 2024
  2. Eclips4
    added
    type-featureA feature request or enhancementA feature request or enhancement
    on Sep 13, 2024
  3. vstinner
    added a commit that references this issue on Sep 13, 2024

    pythongh-124074: Add _Py_NewImmortalRef() function

    6eb358c
  4. vstinner commented on Sep 17, 2024

    @vstinner
    vstinner
    on Sep 17, 2024
    MemberAuthor
    More actions

    I abandon this approach: #124076 (comment)

  5. vstinner
    closed this as completedon Sep 17, 2024
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

    topic-C-APItype-featureA feature request or enhancementA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.