There was an error while loading. Please reload this page.
1 parent e253752 commit 1179f4bCopy full SHA for 1179f4b
2 files changed
Doc/c-api/gcsupport.rst
@@ -49,7 +49,7 @@ Constructors for container types must conform to two rules:
49
.. c:function:: TYPE* PyObject_GC_Resize(TYPE, PyVarObject *op, Py_ssize_t newsize)
50
51
Resize an object allocated by :c:func:`PyObject_NewVar`. Returns the
52
- resized object or *NULL* on failure.
+ resized object or *NULL* on failure. *op* must not be tracked by the collector yet.
53
54
55
.. c:function:: void PyObject_GC_Track(PyObject *op)
Modules/gcmodule.c
@@ -1752,6 +1752,7 @@ _PyObject_GC_Resize(PyVarObject *op, Py_ssize_t nitems)
1752
{
1753
const size_t basicsize = _PyObject_VAR_SIZE(Py_TYPE(op), nitems);
1754
PyGC_Head *g = AS_GC(op);
1755
+ assert(!IS_TRACKED(op));
1756
if (basicsize > PY_SSIZE_T_MAX - sizeof(PyGC_Head))
1757
return (PyVarObject *)PyErr_NoMemory();
1758
g = (PyGC_Head *)PyObject_REALLOC(g, sizeof(PyGC_Head) + basicsize);
0 commit comments