From: sobolevn Date: Sat, 31 May 2025 21:33:02 +0000 (+0300) Subject: gh-133891: Add missing error check to `SET_COUNT` macro in `_testinternalcapi.c`... X-Git-Tag: v3.15.0a1~1427 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cebae977a63f32c3c03d14c040df3cea55b8f585;p=thirdparty%2FPython%2Fcpython.git gh-133891: Add missing error check to `SET_COUNT` macro in `_testinternalcapi.c` (#133892) --- diff --git a/Modules/_testinternalcapi.c b/Modules/_testinternalcapi.c index 136e6a7a0150..845c218e679a 100644 --- a/Modules/_testinternalcapi.c +++ b/Modules/_testinternalcapi.c @@ -1045,6 +1045,9 @@ get_code_var_counts(PyObject *self, PyObject *_args, PyObject *_kwargs) #define SET_COUNT(DICT, STRUCT, NAME) \ do { \ PyObject *count = PyLong_FromLong(STRUCT.NAME); \ + if (count == NULL) { \ + goto error; \ + } \ int res = PyDict_SetItemString(DICT, #NAME, count); \ Py_DECREF(count); \ if (res < 0) { \