]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.12] gh-107915: Handle errors in C API functions PyErr_Set*() and PyErr_Format...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sun, 20 Aug 2023 21:07:24 +0000 (14:07 -0700)
committerGitHub <noreply@github.com>
Sun, 20 Aug 2023 21:07:24 +0000 (23:07 +0200)
commit97d67e9dabb3d66525a46dc4d802195ced24e6ef
tree4501b9e9e344524eb8e6f05e43cc0e5bdf897860
parent7f5a741a28a7b87c9cdb1db87fcb3f0b9ed8ac2a
[3.12] gh-107915: Handle errors in C API functions PyErr_Set*() and PyErr_Format() (GH-107918) (#108134)

* gh-107915: Handle errors in C API functions PyErr_Set*() and PyErr_Format() (GH-107918)

Such C API functions as PyErr_SetString(), PyErr_Format(),
PyErr_SetFromErrnoWithFilename() and many others no longer crash or
ignore errors if it failed to format the error message or decode the
filename. Instead, they keep a corresponding error.
(cherry picked from commit 633ea217a85f6b6ba5bdbc73094254d5811b3485)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* Define PY_SSIZE_T_CLEAN.

---------

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Lib/test/test_capi/test_exceptions.py
Misc/NEWS.d/next/C API/2023-08-13-12-33-00.gh-issue-107915.jQ0wOi.rst [new file with mode: 0644]
Modules/_testcapi/clinic/exceptions.c.h
Modules/_testcapi/exceptions.c
Python/errors.c