KEMBAR78
GH-115776: Rename `Py_TPFLAGS_INLINE_VALUES` as `_Py_TPFLAGS_INLINE_VALUES` by markshannon · Pull Request #128635 · python/cpython · GitHub
Skip to content

Conversation

@markshannon
Copy link
Member

@markshannon markshannon commented Jan 8, 2025

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
Member

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

@markshannon
Copy link
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
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
Copy link
Member

encukou commented Jan 10, 2025

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
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants