Skip to content

gh-93585: Set PyCode_Type.tp_basicsize to sizeof(PyCodeObject) - #93587

Closed
vstinner wants to merge 1 commit into
python:mainfrom
vstinner:code_basicsize
Closed

vstinner wants to merge 1 commit into
python:mainfrom
vstinner:code_basicsize

Conversation

@vstinner

@vstinner vstinner commented Jun 7, 2022

Copy link
Copy Markdown
Member

Cython makes the assumption that PyCode_Type.tp_basicsize equals to
sizeof(PyCodeObject). This assumption is no longer true since the
commit 2bde682. Restore tp_basicsize
until the PyCodeObject structure can use a C99 flexible array of size
zero with the syntax "char co_code_adaptive[]".

Cython makes the assumption that PyCode_Type.tp_basicsize equals to
sizeof(PyCodeObject). This assumption is no longer true since the
commit 2bde682. Restore tp_basicsize
until the PyCodeObject structure can use a C99 flexible array of size
zero with the syntax "char co_code_adaptive[]".

@encukou encukou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no reason to waste one _Py_CODEUNIT of memory per code object. Cython should update its check.

@bedevere-bot

Copy link
Copy Markdown

When you're done making the requested changes, leave the comment: I have made the requested changes; please review again.

@vstinner

vstinner commented Jun 7, 2022

Copy link
Copy Markdown
Member Author

See #93585 (comment) for the rationale for this change.

@vstinner

vstinner commented Jun 7, 2022

Copy link
Copy Markdown
Member Author
@encukou

encukou commented Jun 8, 2022

Copy link
Copy Markdown
Member

I'll close this PR, see the issue for rationale.

@encukou encukou closed this Jun 8, 2022
@vstinner
vstinner deleted the code_basicsize branch June 8, 2022 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

3 participants