From 69b8adf7d3cb54e50940e3c3323fcdf99b56e500 Mon Sep 17 00:00:00 2001 From: sobolevn Date: Sun, 11 May 2025 14:42:18 +0300 Subject: [PATCH] gh-133891: Add missing error check to `SET_COUNT` macro in `_testinternalcapi.c` --- Modules/_testinternalcapi.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Modules/_testinternalcapi.c b/Modules/_testinternalcapi.c index 3030f45d72cefa..d4e46def05a416 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) { \