Skip to content

GH-115776: Rename Py_TPFLAGS_INLINE_VALUES as _Py_TPFLAGS_INLINE_VALUES - #128635

Closed
markshannon wants to merge 2 commits into
python:mainfrom
faster-cpython:make-inline-flag-private
Closed

markshannon wants to merge 2 commits into
python:mainfrom
faster-cpython:make-inline-flag-private

Conversation

@markshannon

@markshannon markshannon commented Jan 8, 2025 •

Copy link
Copy Markdown
Member

The Py_TPFLAGS_INLINE_VALUES should not be used when declaring a static PyTypeObject. It can only be used by the VM when creating a class. It is undocumented, but is exposed in object.h.
This PR adds an underscore prefix to the name to make it clearer that this flag is internal.

@Fidget-Spinner

Copy link
Copy Markdown
Member

There are 2 package using this, but otherwise LGTM https://grep.app/search?q=Py_TPFLAGS_INLINE_VALUES

@markshannon

Copy link
Copy Markdown
Member Author

That's unfortunate. I still think we are better off moving it, as any code using it (except for tools like PySpy) is broken.
I'll deprecate Py_TPFLAGS_INLINE_VALUES instead of removing it, and add a "what's new" entry.

@Fidget-Spinner

Copy link
Copy Markdown
Member

Yeah I realised their usage is wrong. Don't think it's even safe to unset the flag after it's been set.

@encukou

encukou commented Jan 10, 2025

Copy link
Copy Markdown
Member

How do you check whether a type uses this layout (as in JPype)?

The code in JPype is a workaround for earlier breakage. Is there a clean way to do what they need?

@markshannon

Copy link
Copy Markdown
Member Author

Probably too late to get any code changes in for 3.14, and maybe too late to remove it for 3.15.

@markshannon markshannon closed this May 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

3 participants