]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-130163: Fix crashes related to PySys_GetObject() (GH-130503)
authorSerhiy Storchaka <storchaka@gmail.com>
Tue, 25 Feb 2025 21:04:27 +0000 (23:04 +0200)
committerGitHub <noreply@github.com>
Tue, 25 Feb 2025 21:04:27 +0000 (23:04 +0200)
commit0ef4ffeefd1737c18dc9326133c7894d58108c2e
treedc3614077d06e68df192e57505951b80012a2e31
parent2dad1e08ec9d5ddc798a313900613b3d1eeaff6b
gh-130163: Fix crashes related to PySys_GetObject() (GH-130503)

The use of PySys_GetObject() and _PySys_GetAttr(), which return a borrowed
reference, has been replaced by using one of the following functions, which
return a strong reference and distinguish a missing attribute from an error:
_PySys_GetOptionalAttr(), _PySys_GetOptionalAttrString(),
_PySys_GetRequiredAttr(), and _PySys_GetRequiredAttrString().
23 files changed:
Include/internal/pycore_sysmodule.h
Lib/test/test_builtin.py
Lib/test/test_print.py
Lib/test/test_sys.py
Misc/NEWS.d/next/Core_and_Builtins/2025-02-24-14-25-36.gh-issue-130163.rGpc9v.rst [new file with mode: 0644]
Modules/_cursesmodule.c
Modules/_pickle.c
Modules/_threadmodule.c
Modules/_tkinter.c
Modules/faulthandler.c
Modules/syslogmodule.c
Objects/moduleobject.c
Python/_warnings.c
Python/bltinmodule.c
Python/ceval.c
Python/errors.c
Python/import.c
Python/initconfig.c
Python/intrinsics.c
Python/pylifecycle.c
Python/pythonrun.c
Python/sysmodule.c
Python/traceback.c