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

gh-143300: implement `PyUnstable_SetImmortal` by kumaraditya303 · Pull Request #144543 · python/cpython · GitHub

/ cpython Public

gh-143300: implement PyUnstable_SetImmortal - #144543

Merged
kumaraditya303 merged 11 commits into
python:mainfrom
kumaraditya303:immortal
Feb 11, 2026
Merged

gh-143300: implement PyUnstable_SetImmortal#144543
kumaraditya303 merged 11 commits into
python:mainfrom
kumaraditya303:immortal

Conversation

kumaraditya303 commented Feb 6, 2026
edited by github-actions Bot
Loading

Copy link
Copy Markdown
Contributor

Comment thread Doc/c-api/object.rst Outdated
Comment thread Doc/c-api/object.rst Outdated
Comment thread Objects/object.c

ZeroIntensity left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I think we also need to document the guarantees regarding which objects may be made immortal. For example, the following results in an assertion failure:

from ctypes import pythonapi, py_object, c_int

set_immortal = pythonapi.PyUnstable_SetImmortal
set_immortal.argtypes = (py_object,)
set_immortal.restype = c_int

print(set_immortal("Hello world"))

Comment thread Doc/c-api/object.rst Outdated
Comment thread Doc/c-api/object.rst Outdated
Comment thread Doc/c-api/object.rst Outdated
Comment thread Objects/object.c

ZeroIntensity left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Looks pretty good.

Bikeshedding: Should this be named PyUnstable_Object_SetImmortal? The Py[Unstable]_ prefix is generally reserved for runtime operations (though it seems PyUnstable_TryIncRef didn't follow that rule).

Comment thread Doc/c-api/object.rst

Copy link
Copy Markdown
Contributor Author

Should this be named PyUnstable_Object_SetImmortal?

I'd like to keep it aligned with PyObject_IsImmortal and avoid introducing the Object in between.

kumaraditya303 marked this pull request as ready for review February 10, 2026 14:11
Comment thread Doc/c-api/object.rst Outdated

ZeroIntensity left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM!

kumaraditya303 merged commit 347d359 into python:main Feb 11, 2026
51 checks passed
kumaraditya303 deleted the immortal branch February 11, 2026 15:29

Copy link
Copy Markdown
Member

Kumar also added PyUnstable_SetImmortal() function for Python 3.13 and 3.14 in pythoncapi-compat: python/pythoncapi-compat#164.

thunder-coding pushed a commit to thunder-coding/cpython that referenced this pull request Feb 15, 2026
brijkapadia pushed a commit to brijkapadia/cpython that referenced this pull request Feb 28, 2026
ljfp pushed a commit to ljfp/cpython that referenced this pull request Apr 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

5 participants


Back | FazBrowse Home | New Git URL