I added Py_DEPRECATED(3.11)
to PyBytesObject.ob_shash
because I wanted to remove it in 3.13.
But deprecating it is more difficult than removing it for numpy developer. They asked to provide a clean way to avoid deprecation warning.
(Deprecate ob_shash in BytesObject · Issue #91020 · python/cpython · GitHub)
Before adding another API for numpy and other libraries subclassing bytes object but don’t want to call bytes.__new__()
, I want to make it clear that we really need to add Py_DEPRECATED
to structure members.
We change the implementation of builtin types some time.
For example, there is discussion about changing long object (More efficient implementation of integers · Discussion #147 · faster-cpython/ideas · GitHub).
Do we need to add Py_DEPRECATED
and wait two releases before changing the structure of builtin objects?