New issue 3101: PySlice_Unpack usable in CPython > 3.6.1
https://bitbucket.org/pypy/pypy/issues/3101/pyslice_unpack-usable-in-cpython-361

Pierre Augier:

With PyPy3.6 \(7.2\), I get the error `pythran/pythonic/types/slice.hpp:502:3: 
error: use of undeclared identifier 'PySlice_Unpack'`.

In pythonic/types/slice.hpp, there is

```c++
#if PY_MAJOR_VERSION > 3 || (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION > 6) || \
    (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 6 && PY_MICRO_VERSION >= 1)
  PySlice_Unpack(obj, &start, &stop, &step);
#elif PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 1
  PySlice_GetIndices((PyObject *)obj, PY_SSIZE_T_MAX, &start, &stop, &step);
#else
  PySlice_GetIndices((PySliceObject *)obj, PY_SSIZE_T_MAX, &start, &stop,
                     &step);
#endif
```

In the documentation for CPython 3.6, `PySlice_Unpack` is not mentioned, so it 
seems that it is not really a PyPy bug \(?\)

[https://docs.python.org/3.6/c-api/slice.html](https://docs.python.org/3.6/c-api/slice.html)

`PySlice_Unpack` is mentioned in 
[https://docs.python.org/3.7/c-api/slice.html](https://docs.python.org/3.7/c-api/slice.html)

\(See 
[https://github.com/serge-sans-paille/pythran/issues/1395](https://github.com/serge-sans-paille/pythran/issues/1395)\)

I submit a very quick and dirty PR for Pythran to fix this 
[https://github.com/serge-sans-paille/pythran/pull/1397](https://github.com/serge-sans-paille/pythran/pull/1397)

What would be the right way to do that for PyPy3.6 7.2?  Is there a 
PyPy-specific macro definied in the PyPy headers?

‌


_______________________________________________
pypy-issue mailing list
pypy-issue@python.org
https://mail.python.org/mailman/listinfo/pypy-issue

Reply via email to