]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.12] gh-130163: Fix crashes related to PySys_GetObject() (GH-130503) (GH-130556...
authorSerhiy Storchaka <storchaka@gmail.com>
Wed, 26 Feb 2025 15:20:47 +0000 (17:20 +0200)
committerGitHub <noreply@github.com>
Wed, 26 Feb 2025 15:20:47 +0000 (17:20 +0200)
commit89a79fc919419bfe817da13bc2a4437908d7fc07
treed8ca3bac7229ea443ff9d591b0459caac0b67cb1
parent6a268a046f474e860c8d0186a859fdd075d80463
[3.12] gh-130163: Fix crashes related to PySys_GetObject() (GH-130503) (GH-130556) (GH-130576)

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().

(cherry picked from commit 0ef4ffeefd1737c18dc9326133c7894d58108c2e)
(cherry picked from commit 7c1b76fce8c8df00da38830f72dbdde6881a33be)
(cherry picked from commit 2ab7e1135a2d5ca45b60881ece27729e4fc0ee8b)
21 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
Python/_warnings.c
Python/bltinmodule.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