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)
7878 PyErr_SetString (PyExc_ValueError, " read_bool out of bounds" );
7979 return NULL ;
8080 }
81- return *reader->ptr ++ ? Py_True : Py_False;
81+ PyObject *value = *reader->ptr ++ ? Py_True : Py_False;
82+ Py_INCREF (value);
83+ return value;
8284}
8385
8486inline PyObject *read_bool_array (ReaderT *reader, int32_t count)
@@ -91,7 +93,9 @@ inline PyObject *read_bool_array(ReaderT *reader, int32_t count)
9193 PyObject *list = PyList_New (count);
9294 for (auto i = 0 ; i < count; i++)
9395 {
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);
9599 }
96100 return list;
97101}
@@ -1201,9 +1205,9 @@ static PyTypeObject TypeTreeNodeType = []() -> PyTypeObject
12011205{
12021206 PyTypeObject type = {
12031207#if PY_VERSION_HEX >= 0x03080000
1204- PyVarObject_HEAD_INIT (NULL , 0 )
1208+ PyVarObject_HEAD_INIT (NULL , 0 )
12051209#else
1206- PyObject_HEAD_INIT (NULL ) 0
1210+ PyObject_HEAD_INIT (NULL ) 0
12071211#endif
12081212 };
12091213 type.tp_name = " TypeTreeHelper.TypeTreeNode" ;
You can’t perform that action at this time.
0 commit comments