Skip to content

[BUG] cython does not compile with current cpython main #4158

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tacaswell opened this issue May 14, 2021 · 2 comments · Fixed by #4414
Closed

[BUG] cython does not compile with current cpython main #4158

tacaswell opened this issue May 14, 2021 · 2 comments · Fixed by #4414

Comments

@tacaswell
Copy link
Contributor

Describe the bug
A clear and concise description of what the bug is.

python/cpython#25729 / https://bugs.python.org/issue40222 changed the signature of PyCode_NewWithPosOnlyArgs which results in

    gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/home/tcaswell/.virtualenvs/bleeding/include -I/home/tcaswell/.pybuild/bleeding/include/python3.11 -c /tmp/pip-req-build-cit9u2ev/Cython/Plex/Scanners.c -o build/temp.linux-x86_64-3.11/tmp/pip-req-build-cit9u2ev/Cython/Plex/Scanners.o
    /tmp/pip-req-build-cit9u2ev/Cython/Plex/Scanners.c: In function ‘__Pyx_InitCachedConstants’:
    /tmp/pip-req-build-cit9u2ev/Cython/Plex/Scanners.c:429:11: error: too few arguments to function ‘PyCode_NewWithPosOnlyArgs’
      429 |           PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
          |           ^~~~~~~~~~~~~~~~~~~~~~~~~
    /tmp/pip-req-build-cit9u2ev/Cython/Plex/Scanners.c:8314:33: note: in expansion of macro ‘__Pyx_PyCode_New’
     8314 |   __pyx_codeobj__7 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__6, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Cython_Plex_Scanners_py, __pyx_n_s_read, 110, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__7)) __PYX_ERR(0, 110, __pyx_L1_error)
          |                                 ^~~~~~~~~~~~~~~~
    In file included from /home/tcaswell/.pybuild/bleeding/include/python3.11/code.h:13,
                     from /home/tcaswell/.pybuild/bleeding/include/python3.11/Python.h:107,
                     from /tmp/pip-req-build-cit9u2ev/Cython/Plex/Scanners.c:31:
    /home/tcaswell/.pybuild/bleeding/include/python3.11/cpython/code.h:123:28: note: declared here
      123 | PyAPI_FUNC(PyCodeObject *) PyCode_NewWithPosOnlyArgs(
          |                            ^~~~~~~~~~~~~~~~~~~~~~~~~
    /tmp/pip-req-build-cit9u2ev/Cython/Plex/Scanners.c:429:11: error: too few arguments to function ‘PyCode_NewWithPosOnlyArgs’
      429 |           PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
          |           ^~~~~~~~~~~~~~~~~~~~~~~~~
    /tmp/pip-req-build-cit9u2ev/Cython/Plex/Scanners.c:8326:33: note: in expansion of macro ‘__Pyx_PyCode_New’
     8326 |   __pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__8, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Cython_Plex_Scanners_py, __pyx_n_s_position, 297, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 297, __pyx_L1_error)
          |                                 ^~~~~~~~~~~~~~~~
    In file included from /home/tcaswell/.pybuild/bleeding/include/python3.11/code.h:13,
                     from /home/tcaswell/.pybuild/bleeding/include/python3.11/Python.h:107,
                     from /tmp/pip-req-build-cit9u2ev/Cython/Plex/Scanners.c:31:
    /home/tcaswell/.pybuild/bleeding/include/python3.11/cpython/code.h:123:28: note: declared here
      123 | PyAPI_FUNC(PyCodeObject *) PyCode_NewWithPosOnlyArgs(
          |                            ^~~~~~~~~~~~~~~~~~~~~~~~~
    /tmp/pip-req-build-cit9u2ev/Cython/Plex/Scanners.c:429:11: error: too few arguments to function ‘PyCode_NewWithPosOnlyArgs’
      429 |           PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
          |           ^~~~~~~~~~~~~~~~~~~~~~~~~
    /tmp/pip-req-build-cit9u2ev/Cython/Plex/Scanners.c:8338:34: note: in expansion of macro ‘__Pyx_PyCode_New’
     8338 |   __pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__10, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Cython_Plex_Scanners_py, __pyx_n_s_get_position, 308, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(0, 308, __pyx_L1_error)
          |                                  ^~~~~~~~~~~~~~~~
    In file included from /home/tcaswell/.pybuild/bleeding/include/python3.11/code.h:13,
                     from /home/tcaswell/.pybuild/bleeding/include/python3.11/Python.h:107,
                     from /tmp/pip-req-build-cit9u2ev/Cython/Plex/Scanners.c:31:
    /home/tcaswell/.pybuild/bleeding/include/python3.11/cpython/code.h:123:28: note: declared here
      123 | PyAPI_FUNC(PyCodeObject *) PyCode_NewWithPosOnlyArgs(
          |                            ^~~~~~~~~~~~~~~~~~~~~~~~~
    /tmp/pip-req-build-cit9u2ev/Cython/Plex/Scanners.c:429:11: error: too few arguments to function ‘PyCode_NewWithPosOnlyArgs’
      429 |           PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
          |           ^~~~~~~~~~~~~~~~~~~~~~~~~
    /tmp/pip-req-build-cit9u2ev/Cython/Plex/Scanners.c:8350:34: note: in expansion of macro ‘__Pyx_PyCode_New’
     8350 |   __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Cython_Plex_Scanners_py, __pyx_n_s_eof, 335, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 335, __pyx_L1_error)
          |                                  ^~~~~~~~~~~~~~~~
    In file included from /home/tcaswell/.pybuild/bleeding/include/python3.11/code.h:13,
                     from /home/tcaswell/.pybuild/bleeding/include/python3.11/Python.h:107,
                     from /tmp/pip-req-build-cit9u2ev/Cython/Plex/Scanners.c:31:
    /home/tcaswell/.pybuild/bleeding/include/python3.11/cpython/code.h:123:28: note: declared here
      123 | PyAPI_FUNC(PyCodeObject *) PyCode_NewWithPosOnlyArgs(
          |                            ^~~~~~~~~~~~~~~~~~~~~~~~~
    /tmp/pip-req-build-cit9u2ev/Cython/Plex/Scanners.c: In function ‘__Pyx_CreateCodeObjectForTraceback’:
    /tmp/pip-req-build-cit9u2ev/Cython/Plex/Scanners.c:429:11: error: too few arguments to function ‘PyCode_NewWithPosOnlyArgs’
      429 |           PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
          |           ^~~~~~~~~~~~~~~~~~~~~~~~~
    /tmp/pip-req-build-cit9u2ev/Cython/Plex/Scanners.c:12057:15: note: in expansion of macro ‘__Pyx_PyCode_New’
    12057 |     py_code = __Pyx_PyCode_New(
          |               ^~~~~~~~~~~~~~~~
    In file included from /home/tcaswell/.pybuild/bleeding/include/python3.11/code.h:13,
                     from /home/tcaswell/.pybuild/bleeding/include/python3.11/Python.h:107,
                     from /tmp/pip-req-build-cit9u2ev/Cython/Plex/Scanners.c:31:
    /home/tcaswell/.pybuild/bleeding/include/python3.11/cpython/code.h:123:28: note: declared here
      123 | PyAPI_FUNC(PyCodeObject *) PyCode_NewWithPosOnlyArgs(
          |                            ^~~~~~~~~~~~~~~~~~~~~~~~~
    error: command '/lib/ccache/bin/gcc' failed with exit code 1
    Running setup.py install for Cython ... error

To Reproduce

Attempt to compile cython with main branch of cpython (8940916)

Expected behavior
A clear and concise description of what you expected to happen.

Environment (please complete the following information):

  • OS: [e.g. Linux, Windows, macOS]
  • Python version [e.g. 3.8.4]
  • Cython version [e.g. 0.29.18]

Additional context

Add any other context about the problem here.

@scoder is already aware of this: https://bugs.python.org/issue40222#msg393470

Sorry if this is just noise.

@tacaswell tacaswell changed the title [BUG] [BUG] cython does not compile with current cpython main May 14, 2021
@scoder
Copy link
Contributor

scoder commented May 14, 2021

As long as it's not clear if this change will stay in CPython or not, the best we can do is sit and wait.
Also note that this is a change in CPython 3.11, which will only see its first alpha release in about half a year's time.

@hroncok
Copy link
Contributor

hroncok commented Oct 12, 2021

CPython 3.11.0a1 is out and this behavior still exists both with the stable released Cython version and with Cython from the master branch here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants