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: Remove deprecated PySlice_GetIndicesEx(), or remove the deprecation #158077
@serhiy-storchaka deprecated the PySlice_GetIndicesEx() function in Python 3.6.1.
We are now at Python 3.16, 10 releases later. So should we remove PySlice_GetIndicesEx() functon? Or should we keep it just remove the deprecation and keep it forever?
In PyPI top 15,000 projects (at 2026-09-17), I found 79 projects by searching for PySlice_GetIndicesEx:
PyICU-binary (2.7.4)
PyQt5 (5.15.11)
Theano (1.0.5)
Theano-PyMC (1.1.2)
arize_phoenix_sqlean (0.1.2)
biopython (1.88)
bitarray-hardbyte (2.3.8)
btrees (6.5)
catboost (1.2.10)
cffi (2.1.1)
cvxopt (1.3.3)
cython (3.3.0)
ddtrace (4.15.0)
dlib (20.0.1)
ethos_u_vela (5.2.0)
glpk (0.4.8)
gmpy2 (2.3.1)
igraph (1.0.0)
instanttensor (0.2.0)
kuzu (0.11.3)
ladybug (0.20.4)
lxml (6.1.3)
mercurial (7.2.4)
minorminer (0.2.22)
mmcif (1.1.1)
nanobind (3.0.1)
ncnn (1.0.20260526)
ntgcalls (2.2.5)
numba (0.67.0)
numpy (2.5.3)
onnxoptimizer (0.4.2)
open_spiel (2.0.2)
opencc (1.4.2)
opentimelineio (0.18.1)
orjson (3.12.0)
pandas (3.0.5)
passagemath_combinat (10.8.11)
passagemath_modules (10.8.11)
passagemath_standard_no_symbolics (10.8.11)
pillow (12.3.0)
polyscope (2.6.1)
praat_parselmouth (0.4.7)
protovalidate (2.0.0)
pybind11 (3.1.0)
pybind11_global (3.1.0)
pycuda (2026.1)
pydemumble (0.1.3)
pyfastx (2.3.1)
pygame (2.6.1)
pygame_ce (2.5.8)
pyglm (2.8.3)
pyicu (2.16.2)
pymatching (2.4.0)
pyodbc (5.3.0)
pyopencl (2026.1.4)
pyqt5_sip (12.19.0)
pyrsistent (0.20.0)
pysimdjson (7.0.2)
pysqlite3 (0.6.0)
pytensor (3.3.2)
pywhispercpp (1.5.1)
pywinpty (3.0.5)
real_ladybug (0.15.3)
recordclass (0.24.1)
regex (2026.9.10)
rhino3dm (8.35.0)
sip (6.16.1)
sqlcipher3 (0.6.2)
sqlcipher3_wheels (0.5.7)
sqlean_py (3.50.4.5)
stpyv8 (13.1.201.22)
symusic (0.6.0)
ur_rtde (1.6.5)
viennarna (2.7.2)
winrt_windows_devices_enumeration (3.2.1)
winrt_windows_foundation (3.2.1)
winsdk-1.0.0b10
wxpython (4.3.1)
xatlas (0.0.11)
That's a long list of projects. So I'm not sure that it's a good idea to break them if we can continue to maintain PySlice_GetIndicesEx(). But I would prefer to keep the deprecation.
Can we do something to reduce the list of affected projects?
The PySlice_GetIndicesEx() function was redefined as a PySlice_GetIndicesEx() macro, which is safe to use (because it is a macro, and length is calculated after calling PySlice_Unpack() with other arguments). If projects do not define Py_LIMITED_API or define it >= 0x03060100, they are safe and do not need to change their code.
Oh, I didn't recall the complex situation of this function. Hum.
I don't think that it has to be that complicated. I propose to remove the deprecated and unsafe function implementation, leave a static inline function implementation, and remove the deprecation. The C API would not be affected.
Activity
serhiy-storchaka commentedon Sep 24, 2026
The
PySlice_GetIndicesEx()function was redefined as aPySlice_GetIndicesEx()macro, which is safe to use (because it is a macro, andlengthis calculated after callingPySlice_Unpack()with other arguments). If projects do not define Py_LIMITED_API or define it >= 0x03060100, they are safe and do not need to change their code.pythongh-158077: Remove deprecated PySlice_GetIndicesEx() function
vstinner commentedon Sep 24, 2026
Oh, I didn't recall the complex situation of this function. Hum.
I don't think that it has to be that complicated. I propose to remove the deprecated and unsafe function implementation, leave a static inline function implementation, and remove the deprecation. The C API would not be affected.
I created PR gh-158089 to do that.
vstinner commentedon Sep 24, 2026
PySlice_GetIndicesEx()function was reimplemented as a macro by commit b2a5be0 from issue gh-72054.Py_DEPRECATED(3.7)was only added later, by commit 3c8724f.gvanrossum commentedon Sep 24, 2026
Try opening issues or PRs to the most commonly-used projects on the list. (IIRC Hugo maintains a list of PyPI projects by popularity.)