File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -78,7 +78,9 @@ inline PyObject *read_bool(ReaderT *reader)
78
78
PyErr_SetString (PyExc_ValueError, " read_bool out of bounds" );
79
79
return NULL ;
80
80
}
81
- return *reader->ptr ++ ? Py_True : Py_False;
81
+ PyObject *value = *reader->ptr ++ ? Py_True : Py_False;
82
+ Py_INCREF (value);
83
+ return value;
82
84
}
83
85
84
86
inline PyObject *read_bool_array (ReaderT *reader, int32_t count)
@@ -91,7 +93,9 @@ inline PyObject *read_bool_array(ReaderT *reader, int32_t count)
91
93
PyObject *list = PyList_New (count);
92
94
for (auto i = 0 ; i < count; i++)
93
95
{
94
- PyList_SET_ITEM (list, i, *reader->ptr ++ ? Py_True : Py_False);
96
+ PyObject *value = *reader->ptr ++ ? Py_True : Py_False;
97
+ Py_INCREF (value);
98
+ PyList_SET_ITEM (list, i, value);
95
99
}
96
100
return list;
97
101
}
@@ -1201,9 +1205,9 @@ static PyTypeObject TypeTreeNodeType = []() -> PyTypeObject
1201
1205
{
1202
1206
PyTypeObject type = {
1203
1207
#if PY_VERSION_HEX >= 0x03080000
1204
- PyVarObject_HEAD_INIT (NULL , 0 )
1208
+ PyVarObject_HEAD_INIT (NULL , 0 )
1205
1209
#else
1206
- PyObject_HEAD_INIT (NULL ) 0
1210
+ PyObject_HEAD_INIT (NULL ) 0
1207
1211
#endif
1208
1212
};
1209
1213
type.tp_name = " TypeTreeHelper.TypeTreeNode" ;
You can’t perform that action at this time.
0 commit comments