Skip to content

[3.15] gh-155905: Fix error handling in _testcapi helpers (GH-155906) - #156580

Open
miss-islington wants to merge 1 commit into
python:3.15from
miss-islington:backport-a175da7-3.15
Open

[3.15] gh-155905: Fix error handling in _testcapi helpers (GH-155906)#156580
miss-islington wants to merge 1 commit into
python:3.15from
miss-islington:backport-a175da7-3.15

Conversation

@miss-islington

@miss-islington miss-islington commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Py_fopen() sets an exception and returns NULL on error. The
pyobject_print*() helpers did not check the result and crashed, and the
pymarshal_*() helpers set a second exception on top of it.

The pyobject_print*() helpers which take a single argument now use
METH_O, and the result of PyUnicode_FromString() is now checked.
(cherry picked from commit a175da7)

Co-authored-by: Serhiy Storchaka storchaka@gmail.com
Co-authored-by: Claude Opus 5 (1M context) noreply@anthropic.com

…5906)

Py_fopen() sets an exception and returns NULL on error.  The
pyobject_print*() helpers did not check the result and crashed, and the
pymarshal_*() helpers set a second exception on top of it.

The pyobject_print*() helpers which take a single argument now use
METH_O, and the result of PyUnicode_FromString() is now checked.
(cherry picked from commit a175da7)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
@bedevere-app bedevere-app Bot added skip news type-crash A hard crash of the interpreter, possibly with a core dump awaiting review labels Aug 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review skip news type-crash A hard crash of the interpreter, possibly with a core dump

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants