[3.14] gh-133891: Add missing error check to SET_COUNT macro in _testinternalcapi.c (GH-133892) (#134988)

gh-133891: Add missing error check to `SET_COUNT` macro in `_testinternalcapi.c` (GH-133892)
(cherry picked from commit cebae977a6)

Co-authored-by: sobolevn <mail@sobolevn.me>
This commit is contained in:
Miss Islington (bot) 2025-05-31 23:57:52 +02:00 committed by GitHub
parent 890607fa05
commit a8708f7320
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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) { \