Conversation
Only remove the function implementation. PySlice_GetIndicesEx() remains available as a static inline function, so the API does not change. Convert PySlice_GetIndicesEx() macro to a static inline functions. Arguments are now only evaluated once. The function is no longer supported on limited C API older than 3.6.1.
| Py_ssize_t *step, | ||
| Py_ssize_t *slicelength); | ||
|
|
||
| #if !defined(Py_LIMITED_API) || (Py_LIMITED_API+0 >= 0x03050400 && Py_LIMITED_API+0 < 0x03060000) || Py_LIMITED_API+0 >= 0x03060100 |
There was a problem hiding this comment.
I don't think that Python 3.16 should both with limited C API 3.5.x. Use Python 3.16 to target the recent stable ABI. Or use an old Python version to target an old stable ABI version. I prefer to remove (Py_LIMITED_API+0 >= 0x03050400 && Py_LIMITED_API+0 < 0x03060000).
There was a problem hiding this comment.
Since Python 3.6 is no longer supported upstream, we may even simplify the check as Py_LIMITED_API+0 >= _Py_PACK_VERSION(3, 7).
| *slicelen = PySlice_AdjustIndices(length, start, stop, *step); | ||
| return 0; | ||
| } | ||
| #define PySlice_GetIndicesEx _PySlice_GetIndicesEx |
There was a problem hiding this comment.
The static inline function should have a different name, so sliceobject.c can implement a function under "PySlice_GetIndicesEx" name.
There was a problem hiding this comment.
This is wrong. The point of the macro is that length is evaluated after calling PySlice_Unpack. This can only be implemented as a macro.
There was a problem hiding this comment.
Ah? It wasn't obvious to me at all when I read the macro. Also, it seems like PySlice_GetIndicesEx() is not tested.
|
|
||
| * Remove :c:func:`PySlice_GetIndicesEx` function, deprecated since Python 3.7. | ||
| Only remove the function implementation: :c:func:`PySlice_GetIndicesEx` | ||
| remains available as a static inline function, so the API does not change. |
There was a problem hiding this comment.
Since the C API is not affected, I'm not sure that it's worth it to mention this change to users. They should not be affected in practice. (The Changelog can also be removed.)
There was a problem hiding this comment.
Ah yes, if you want to write tests, please go ahead! I was planning to do that after you told me that length should be evaluated later.
Documentation build overview
9 files changed ·
|
|
What's the point of this PR? Nothing changes, we still have the same amount of code, it's just laid out differently. That's a lot of maintenance for a deprecated function. Why not leave things alone? |
Only remove the function implementation. PySlice_GetIndicesEx() remains available as a static inline function, so the API does not change.
Convert PySlice_GetIndicesEx() macro to a static inline functions. Arguments are now only evaluated once.
The function is no longer supported on limited C API older than 3.6.1.
PySlice_GetIndicesEx(), or remove the deprecation #158077