Skip to content

Commit d31429b

Browse files
iritkatrielestyxx
authored andcommitted
pythongh-120834: fix over-allocation in PyGenObject, PyCoroObject, PyAsyncGenObject. (python#120941)
1 parent 8cf310c commit d31429b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Objects/genobject.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,7 @@ static PyAsyncMethods gen_as_async = {
813813
PyTypeObject PyGen_Type = {
814814
PyVarObject_HEAD_INIT(&PyType_Type, 0)
815815
"generator", /* tp_name */
816-
sizeof(PyGenObject), /* tp_basicsize */
816+
offsetof(PyGenObject, gi_iframe.localsplus), /* tp_basicsize */
817817
sizeof(PyObject *), /* tp_itemsize */
818818
/* methods */
819819
(destructor)gen_dealloc, /* tp_dealloc */
@@ -1164,7 +1164,7 @@ static PyAsyncMethods coro_as_async = {
11641164
PyTypeObject PyCoro_Type = {
11651165
PyVarObject_HEAD_INIT(&PyType_Type, 0)
11661166
"coroutine", /* tp_name */
1167-
sizeof(PyCoroObject), /* tp_basicsize */
1167+
offsetof(PyCoroObject, cr_iframe.localsplus),/* tp_basicsize */
11681168
sizeof(PyObject *), /* tp_itemsize */
11691169
/* methods */
11701170
(destructor)gen_dealloc, /* tp_dealloc */
@@ -1579,7 +1579,7 @@ static PyAsyncMethods async_gen_as_async = {
15791579
PyTypeObject PyAsyncGen_Type = {
15801580
PyVarObject_HEAD_INIT(&PyType_Type, 0)
15811581
"async_generator", /* tp_name */
1582-
sizeof(PyAsyncGenObject), /* tp_basicsize */
1582+
offsetof(PyAsyncGenObject, ag_iframe.localsplus), /* tp_basicsize */
15831583
sizeof(PyObject *), /* tp_itemsize */
15841584
/* methods */
15851585
(destructor)gen_dealloc, /* tp_dealloc */

0 commit comments

Comments
 (0)