Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8c18f25

Browse files
committed
_PyObject_GC_Malloc(): split a complicated line in two. As is, there was
no way to talk the debugger into showing me how many bytes were being allocated.
1 parent 8c2c3d3 commit 8c18f25

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

Modules/gcmodule.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -802,8 +802,9 @@ _PyObject_GC_Malloc(PyTypeObject *tp, int size)
802802
{
803803
PyObject *op;
804804
#ifdef WITH_CYCLE_GC
805-
PyGC_Head *g = PyObject_MALLOC(_PyObject_VAR_SIZE(tp, size) +
806-
sizeof(PyGC_Head));
805+
const size_t nbytes = sizeof(PyGC_Head) +
806+
(size_t)_PyObject_VAR_SIZE(tp, size);
807+
PyGC_Head *g = PyObject_MALLOC(nbytes);
807808
if (g == NULL)
808809
return (PyObject *)PyErr_NoMemory();
809810
g->gc_next = NULL;

0 commit comments

Comments
 (0)