]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.13] GH-132417: ctypes: Fix potential `Py_DECREF(NULL)` when handling functions...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sat, 12 Apr 2025 09:14:07 +0000 (11:14 +0200)
committerGitHub <noreply@github.com>
Sat, 12 Apr 2025 09:14:07 +0000 (09:14 +0000)
commit0aabe44fa8a8159561c04a9b6e7450bfaa319e94
tree05fa36130e30013d534863ba56ce1c3b9dd94002
parent089c43f1601c88a2744fa960fd958ed05f741ba7
[3.13] GH-132417: ctypes: Fix potential `Py_DECREF(NULL)` when handling functions returning `PyObject *` (GH-132418) (#132425)

GH-132417: ctypes: Fix potential `Py_DECREF(NULL)` when handling functions returning `PyObject *` (GH-132418)

Some functions (such as `PyErr_Occurred`) with a `restype` set to `ctypes.py_object` may return NULL without setting an exception.
(cherry picked from commit 2aab2db1461ef49b42549255af16a74b1bf8a5ef)

Co-authored-by: Nicolas Trangez <ikke@nicolast.be>
Lib/test/test_ctypes/test_refcounts.py
Misc/NEWS.d/next/Library/2025-04-11-21-48-49.gh-issue-132417.uILGdS.rst [new file with mode: 0644]
Modules/_ctypes/callproc.c