SIGN IN SIGN UP

[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>
M
Miss Islington (bot) committed
0aabe44fa8a8159561c04a9b6e7450bfaa319e94
Parent: 089c43f
Committed by GitHub <noreply@github.com> on 4/12/2025, 9:14:07 AM