You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[C API] Change PyTypeObject.tp_flags type to uint64_t #161562
The updated PyType_Spec documentation in the PR suggest using PyType_FromSlots() if you need 64-bit flags. If you don't need new 64-bit flags, it's fine to still use PyType_Spec().
Likewise for PyType_GetFlags where the return value is an unsigned long (32-bit on 32-bit platforms, and on 64-bit windows)
With my change, PyType_GetFlags() return type changes to uint64_t when using non-limited C API or when using the limited C API version 3.16 or newer. It stays as unsigned long when using the limited C API version 3.15 or newer (stable ABI!). See the PR for details.
Activity
pythongh-161562: Change PyTypeObject.tp_flags type to uint64_t
pythongh-161562: Change PyTypeObject.tp_flags type to uint64_t
ronaldoussoren commentedon Nov 8, 2026
Isn't this a duplicate for #134860?
As mentioned in that issue: Flags are also an unsigned int in PyType_Spec, which is part of the stable ABI. See https://docs.python.org/3/c-api/type.html#c.PyType_Spec.flags
Likewise for PyType_GetFlags where the return value is an unsigned long (32-bit on 32-bit platforms, and on 64-bit windows)
vstinner commentedon Nov 8, 2026
Oh, I wasn't aware of this issue. Well, this issue is a concrete change to implement the "Change PyTypeObject.tp_flags type to uint64_t" option.
The updated PyType_Spec documentation in the PR suggest using
PyType_FromSlots()if you need 64-bit flags. If you don't need new 64-bit flags, it's fine to still use PyType_Spec().With my change, PyType_GetFlags() return type changes to uint64_t when using non-limited C API or when using the limited C API version 3.16 or newer. It stays as
unsigned longwhen using the limited C API version 3.15 or newer (stable ABI!). See the PR for details.