Skip to content

Commit 99b8dbd

Browse files
committed
pythongh-120834: fix over-allocation in PyGenObject, PyCoroObject, PyAsyncGenObject.
1 parent 83d3d7a commit 99b8dbd

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

Objects/genobject.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -814,8 +814,7 @@ static PyAsyncMethods gen_as_async = {
814814
PyTypeObject PyGen_Type = {
815815
PyVarObject_HEAD_INIT(&PyType_Type, 0)
816816
"generator", /* tp_name */
817-
offsetof(PyGenObject, gi_iframe) +
818-
offsetof(_PyInterpreterFrame, localsplus), /* tp_basicsize */
817+
offsetof(PyGenObject, gi_iframe.localsplus), /* tp_basicsize */
819818
sizeof(PyObject *), /* tp_itemsize */
820819
/* methods */
821820
(destructor)gen_dealloc, /* tp_dealloc */
@@ -1166,8 +1165,7 @@ static PyAsyncMethods coro_as_async = {
11661165
PyTypeObject PyCoro_Type = {
11671166
PyVarObject_HEAD_INIT(&PyType_Type, 0)
11681167
"coroutine", /* tp_name */
1169-
offsetof(PyCoroObject, cr_iframe) +
1170-
offsetof(_PyInterpreterFrame, localsplus), /* tp_basicsize */
1168+
offsetof(PyCoroObject, cr_iframe.localsplus),/* tp_basicsize */
11711169
sizeof(PyObject *), /* tp_itemsize */
11721170
/* methods */
11731171
(destructor)gen_dealloc, /* tp_dealloc */
@@ -1582,8 +1580,7 @@ static PyAsyncMethods async_gen_as_async = {
15821580
PyTypeObject PyAsyncGen_Type = {
15831581
PyVarObject_HEAD_INIT(&PyType_Type, 0)
15841582
"async_generator", /* tp_name */
1585-
offsetof(PyAsyncGenObject, ag_iframe) +
1586-
offsetof(_PyInterpreterFrame, localsplus), /* tp_basicsize */
1583+
offsetof(PyAsyncGenObject, ag_iframe.localsplus), /* tp_basicsize */
15871584
sizeof(PyObject *), /* tp_itemsize */
15881585
/* methods */
15891586
(destructor)gen_dealloc, /* tp_dealloc */

0 commit comments

Comments
 (0)