]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-84436: Implement Immortal Objects (gh-19474)
authorEddie Elizondo <eduardo.elizondorueda@gmail.com>
Sat, 22 Apr 2023 19:39:37 +0000 (15:39 -0400)
committerGitHub <noreply@github.com>
Sat, 22 Apr 2023 19:39:37 +0000 (13:39 -0600)
commitea2c0016502472aa8baa3149050ada776d17a009
treee9e3935a9b71a1f88ac18c24fe512d199880ff90
parent916de04fd1838530096336aadb3b94b774ed6c90
gh-84436: Implement Immortal Objects (gh-19474)

This is the implementation of PEP683

Motivation:

The PR introduces the ability to immortalize instances in CPython which bypasses reference counting. Tagging objects as immortal allows up to skip certain operations when we know that the object will be around for the entire execution of the runtime.

Note that this by itself will bring a performance regression to the runtime due to the extra reference count checks. However, this brings the ability of having truly immutable objects that are useful in other contexts such as immutable data sharing between sub-interpreters.
35 files changed:
Doc/library/sys.rst
Doc/whatsnew/3.12.rst
Include/boolobject.h
Include/cpython/unicodeobject.h
Include/internal/pycore_global_objects_fini_generated.h
Include/internal/pycore_long.h
Include/internal/pycore_object.h
Include/internal/pycore_runtime_init.h
Include/internal/pycore_unicodeobject.h
Include/object.h
Include/pyport.h
Lib/test/_test_embed_structseq.py
Lib/test/libregrtest/refleak.py
Lib/test/test_builtin.py
Lib/test/test_ctypes/test_python_api.py
Lib/test/test_sys.py
Lib/test/test_venv.py
Misc/NEWS.d/next/Core and Builtins/2023-04-02-22-14-57.gh-issue-84436.hvMgwF.rst [new file with mode: 0644]
Modules/gcmodule.c
Objects/boolobject.c
Objects/bytes_methods.c
Objects/longobject.c
Objects/object.c
Objects/setobject.c
Objects/sliceobject.c
Objects/typeobject.c
Objects/unicodeobject.c
Programs/_testembed.c
Python/ceval.c
Python/clinic/sysmodule.c.h
Python/instrumentation.c
Python/legacy_tracing.c
Python/pylifecycle.c
Python/sysmodule.c
Tools/build/deepfreeze.py