aio-libs/yarl

`_quoting_c.c` is not compatible with Python 3.11.

felixxm opened this issue · 28 comments

Describe the bug

We'd like to test Django with Python 3.11 on Windows. Unfortunately yarl/_quoting_c.c is not compatible with Python 3.11 because longintrepr.h is missing:

 Failed to build numpy Pillow aiohttp frozenlist yarl
  "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.31.31103\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\hostedtoolcache\windows\Python\3.11.0-alpha.6\x64\include -IC:\hostedtoolcache\windows\Python\3.11.0-alpha.6\x64\Include "-IC:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.31.31103\ATLMFC\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.31.31103\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\cppwinrt" /Tcyarl/_quoting_c.c /Fobuild\temp.win-amd64-3.11\Release\yarl/_quoting_c.obj
  _quoting_c.c
  yarl/_quoting_c.c(198): fatal error C1083: Cannot open include file: 'longintrepr.h': No such file or directory
  error: command 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Tools\\MSVC\\14.31.31103\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2

see logs.

Thanks for all your efforts 🏆

To Reproduce

$ python3.11 -m venv .yarl-3.11
$ . .yarl-3.11/bin/activate
$ pip install yarl==1.7.2

Expected behavior

yarl installation works on Python 3.11.

Logs/tracebacks

Collecting yarl==1.7.2
  Downloading yarl-1.7.2.tar.gz (168 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 168.6/168.6 KB 1.7 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: idna>=2.0 in ./.yarl-3.11/lib/python3.11/site-packages (from yarl==1.7.2) (3.3)
Requirement already satisfied: multidict>=4.0 in ./.yarl-3.11/lib/python3.11/site-packages (from yarl==1.7.2) (6.0.2)
Building wheels for collected packages: yarl
  Building wheel for yarl (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for yarl (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [266 lines of output]
      **********************
      * Accelerated build *
      **********************
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-3.11
      creating build/lib.linux-x86_64-3.11/yarl
      copying yarl/_quoting.py -> build/lib.linux-x86_64-3.11/yarl
      copying yarl/_quoting_py.py -> build/lib.linux-x86_64-3.11/yarl
      copying yarl/_url.py -> build/lib.linux-x86_64-3.11/yarl
      copying yarl/__init__.py -> build/lib.linux-x86_64-3.11/yarl
      running egg_info
      writing yarl.egg-info/PKG-INFO
      writing dependency_links to yarl.egg-info/dependency_links.txt
      writing requirements to yarl.egg-info/requires.txt
      writing top-level names to yarl.egg-info/top_level.txt
      reading manifest file 'yarl.egg-info/SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      warning: no previously-included files matching '*.pyc' found anywhere in distribution
      warning: no previously-included files matching '*.cache' found anywhere in distribution
      warning: no previously-included files found matching 'yarl/*.html'
      warning: no previously-included files found matching 'yarl/*.so'
      warning: no previously-included files found matching 'yarl/*.pyd'
      no previously-included directories found matching 'docs/_build'
      adding license file 'LICENSE'
      writing manifest file 'yarl.egg-info/SOURCES.txt'
      copying yarl/__init__.pyi -> build/lib.linux-x86_64-3.11/yarl
      copying yarl/_quoting_c.c -> build/lib.linux-x86_64-3.11/yarl
      copying yarl/_quoting_c.pyi -> build/lib.linux-x86_64-3.11/yarl
      copying yarl/_quoting_c.pyx -> build/lib.linux-x86_64-3.11/yarl
      copying yarl/py.typed -> build/lib.linux-x86_64-3.11/yarl
      running build_ext
      building 'yarl._quoting_c' extension
      creating build/temp.linux-x86_64-3.11
      creating build/temp.linux-x86_64-3.11/yarl
      gcc -pthread -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/home/felixx/repo/yarl/.yarl-3.11/include -I/usr/local/include/python3.11 -c yarl/_quoting_c.c -o build/temp.linux-x86_64-3.11/yarl/_quoting_c.o
      yarl/_quoting_c.c: In function ‘__Pyx_InitCachedConstants’:
      yarl/_quoting_c.c:7808:259: warning: passing argument 14 of ‘PyCode_New’ makes pointer from integer without a cast [-Wint-conversion]
       7808 |   __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle__Quoter, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(1, 1, __pyx_L1_error)
            |                                                                                                                                                                                                                                                                   ^
            |                                                                                                                                                                                                                                                                   |
            |                                                                                                                                                                                                                                                                   int
      yarl/_quoting_c.c:320:72: note: in definition of macro ‘__Pyx_PyCode_New’
        320 |           PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
            |                                                                        ^~~~~
      In file included from /usr/local/include/python3.11/code.h:11,
                       from /usr/local/include/python3.11/Python.h:71,
                       from yarl/_quoting_c.c:6:
      /usr/local/include/python3.11/cpython/code.h:153:28: note: expected ‘PyObject *’ {aka ‘struct _object *’} but argument is of typeint153 | PyAPI_FUNC(PyCodeObject *) PyCode_New(
            |                            ^~~~~~~~~~
      yarl/_quoting_c.c:7808:262: warning: passing argument 15 of ‘PyCode_New’ makes integer from pointer without a cast [-Wint-conversion]
       7808 |   __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle__Quoter, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(1, 1, __pyx_L1_error)
            |                                                                                                                                                                                                                                                                      ^~~~~~~~~~~~~~~~~
            |                                                                                                                                                                                                                                                                      |
            |                                                                                                                                                                                                                                                                      PyObject * {aka struct _object *}
      yarl/_quoting_c.c:320:79: note: in definition of macro ‘__Pyx_PyCode_New’
        320 |           PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
            |                                                                               ^~~~
      In file included from /usr/local/include/python3.11/code.h:11,
                       from /usr/local/include/python3.11/Python.h:71,
                       from yarl/_quoting_c.c:6:
      /usr/local/include/python3.11/cpython/code.h:153:28: note: expected ‘int’ but argument is of type ‘PyObject *’ {aka ‘struct _object *’}
        153 | PyAPI_FUNC(PyCodeObject *) PyCode_New(
            |                            ^~~~~~~~~~
      yarl/_quoting_c.c:320:11: error: too few arguments to function ‘PyCode_New’
        320 |           PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
            |           ^~~~~~~~~~
      yarl/_quoting_c.c:7808:34: note: in expansion of macro ‘__Pyx_PyCode_New’
       7808 |   __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle__Quoter, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(1, 1, __pyx_L1_error)
            |                                  ^~~~~~~~~~~~~~~~
      In file included from /usr/local/include/python3.11/code.h:11,
                       from /usr/local/include/python3.11/Python.h:71,
                       from yarl/_quoting_c.c:6:
      /usr/local/include/python3.11/cpython/code.h:153:28: note: declared here
        153 | PyAPI_FUNC(PyCodeObject *) PyCode_New(
            |                            ^~~~~~~~~~
      yarl/_quoting_c.c:7812:261: warning: passing argument 14 of ‘PyCode_New’ makes pointer from integer without a cast [-Wint-conversion]
       7812 |   __pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle__Unquoter, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(1, 1, __pyx_L1_error)
            |                                                                                                                                                                                                                                                                     ^
            |                                                                                                                                                                                                                                                                     |
            |                                                                                                                                                                                                                                                                     int
      yarl/_quoting_c.c:320:72: note: in definition of macro ‘__Pyx_PyCode_New’
        320 |           PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
            |                                                                        ^~~~~
      In file included from /usr/local/include/python3.11/code.h:11,
                       from /usr/local/include/python3.11/Python.h:71,
                       from yarl/_quoting_c.c:6:
      /usr/local/include/python3.11/cpython/code.h:153:28: note: expected ‘PyObject *’ {aka ‘struct _object *’} but argument is of typeint153 | PyAPI_FUNC(PyCodeObject *) PyCode_New(
            |                            ^~~~~~~~~~
      yarl/_quoting_c.c:7812:264: warning: passing argument 15 of ‘PyCode_New’ makes integer from pointer without a cast [-Wint-conversion]
       7812 |   __pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle__Unquoter, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(1, 1, __pyx_L1_error)
            |                                                                                                                                                                                                                                                                        ^~~~~~~~~~~~~~~~~
            |                                                                                                                                                                                                                                                                        |
            |                                                                                                                                                                                                                                                                        PyObject * {aka struct _object *}
      yarl/_quoting_c.c:320:79: note: in definition of macro ‘__Pyx_PyCode_New’
        320 |           PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
            |                                                                               ^~~~
      In file included from /usr/local/include/python3.11/code.h:11,
                       from /usr/local/include/python3.11/Python.h:71,
                       from yarl/_quoting_c.c:6:
      /usr/local/include/python3.11/cpython/code.h:153:28: note: expected ‘int’ but argument is of type ‘PyObject *’ {aka ‘struct _object *’}
        153 | PyAPI_FUNC(PyCodeObject *) PyCode_New(
            |                            ^~~~~~~~~~
      yarl/_quoting_c.c:320:11: error: too few arguments to function ‘PyCode_New’
        320 |           PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
            |           ^~~~~~~~~~
      yarl/_quoting_c.c:7812:34: note: in expansion of macro ‘__Pyx_PyCode_New’
       7812 |   __pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle__Unquoter, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(1, 1, __pyx_L1_error)
            |                                  ^~~~~~~~~~~~~~~~
      In file included from /usr/local/include/python3.11/code.h:11,
                       from /usr/local/include/python3.11/Python.h:71,
                       from yarl/_quoting_c.c:6:
      /usr/local/include/python3.11/cpython/code.h:153:28: note: declared here
        153 | PyAPI_FUNC(PyCodeObject *) PyCode_New(
            |                            ^~~~~~~~~~
      yarl/_quoting_c.c: In function ‘__pyx_pymod_exec__quoting_c’:
      yarl/_quoting_c.c:1088:43: error: invalid application of ‘sizeof’ to incomplete type ‘PyFrameObject’ {aka ‘struct _frame’}
       1088 |     ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
            |                                           ^~~~~~~~~~~~~
      yarl/_quoting_c.c:1081:27: note: in definition of macro ‘__Pyx_BUILD_ASSERT_EXPR’
       1081 |     (sizeof(char [1 - 2*!(cond)]) - 1)
            |                           ^~~~
      yarl/_quoting_c.c:8079:3: note: in expansion of macro ‘__Pxy_PyFrame_Initialize_Offsets’
       8079 |   __Pxy_PyFrame_Initialize_Offsets();
            |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      yarl/_quoting_c.c:1088:61: error: invalid use of incomplete typedef ‘PyFrameObject’ {aka ‘struct _frame’}
       1088 |     ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
            |                                                             ^~~~~~~~
      yarl/_quoting_c.c:1081:27: note: in definition of macro ‘__Pyx_BUILD_ASSERT_EXPR’
       1081 |     (sizeof(char [1 - 2*!(cond)]) - 1)
            |                           ^~~~
      yarl/_quoting_c.c:8079:3: note: in expansion of macro ‘__Pxy_PyFrame_Initialize_Offsets’
       8079 |   __Pxy_PyFrame_Initialize_Offsets();
            |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      /usr/local/include/python3.11/pymacro.h:22:56: error: dereferencing pointer to incomplete type ‘PyFrameObject’ {aka ‘struct _frame’}
         22 | #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
            |                                                        ^~
      yarl/_quoting_c.c:1081:27: note: in definition of macro ‘__Pyx_BUILD_ASSERT_EXPR’
       1081 |     (sizeof(char [1 - 2*!(cond)]) - 1)
            |                           ^~~~
      yarl/_quoting_c.c:1088:101: note: in expansion of macro ‘Py_MEMBER_SIZE’
       1088 |     ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
            |                                                                                                     ^~~~~~~~~~~~~~
      yarl/_quoting_c.c:8079:3: note: in expansion of macro ‘__Pxy_PyFrame_Initialize_Offsets’
       8079 |   __Pxy_PyFrame_Initialize_Offsets();
            |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      yarl/_quoting_c.c: In function ‘__Pyx_PyFunction_FastCallNoKw’:
      yarl/_quoting_c.c:9004:15: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘recursion_depth’; did you mean ‘recursion_limit’?
       9004 |     ++tstate->recursion_depth;
            |               ^~~~~~~~~~~~~~~
            |               recursion_limit
      yarl/_quoting_c.c:9006:15: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘recursion_depth’; did you mean ‘recursion_limit’?
       9006 |     --tstate->recursion_depth;
            |               ^~~~~~~~~~~~~~~
            |               recursion_limit
      yarl/_quoting_c.c: In function ‘__Pyx_PyFunction_FastCallDict’:
      yarl/_quoting_c.c:9033:60: error: ‘CO_NOFREE’ undeclared (first use in this function)
       9033 |             co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
            |                                                            ^~~~~~~~~
      yarl/_quoting_c.c:9033:60: note: each undeclared identifier is reported only once for each function it appears in
      yarl/_quoting_c.c: In function ‘__Pyx__GetException’:
      yarl/_quoting_c.c:9200:28: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_type’
       9200 |         tmp_type = exc_info->exc_type;
            |                            ^~
      yarl/_quoting_c.c:9202:26: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_traceback’
       9202 |         tmp_tb = exc_info->exc_traceback;
            |                          ^~
      yarl/_quoting_c.c:9203:17: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_type’
       9203 |         exc_info->exc_type = local_type;
            |                 ^~
      yarl/_quoting_c.c:9205:17: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_traceback’
       9205 |         exc_info->exc_traceback = local_tb;
            |                 ^~
      yarl/_quoting_c.c: In function ‘__Pyx__ExceptionSwap’:
      yarl/_quoting_c.c:9238:24: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_type’
       9238 |     tmp_type = exc_info->exc_type;
            |                        ^~
      yarl/_quoting_c.c:9240:22: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_traceback’
       9240 |     tmp_tb = exc_info->exc_traceback;
            |                      ^~
      yarl/_quoting_c.c:9241:13: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_type’
       9241 |     exc_info->exc_type = *type;
            |             ^~
      yarl/_quoting_c.c:9243:13: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_traceback’
       9243 |     exc_info->exc_traceback = *tb;
            |             ^~
      yarl/_quoting_c.c: In function ‘__Pyx_PyErr_GetTopmostException’:
      yarl/_quoting_c.c:9273:21: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_type’
       9273 |     while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
            |                     ^~
      yarl/_quoting_c.c:9273:51: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_type’
       9273 |     while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
            |                                                   ^~
      yarl/_quoting_c.c: In function ‘__Pyx__ExceptionSave’:
      yarl/_quoting_c.c:9287:21: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_type’
       9287 |     *type = exc_info->exc_type;
            |                     ^~
      yarl/_quoting_c.c:9289:19: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_traceback’
       9289 |     *tb = exc_info->exc_traceback;
            |                   ^~
      yarl/_quoting_c.c: In function ‘__Pyx__ExceptionReset’:
      yarl/_quoting_c.c:9303:24: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_type’
       9303 |     tmp_type = exc_info->exc_type;
            |                        ^~
      yarl/_quoting_c.c:9305:22: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_traceback’
       9305 |     tmp_tb = exc_info->exc_traceback;
            |                      ^~
      yarl/_quoting_c.c:9306:13: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_type’
       9306 |     exc_info->exc_type = type;
            |             ^~
      yarl/_quoting_c.c:9308:13: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_traceback’
       9308 |     exc_info->exc_traceback = tb;
            |             ^~
      yarl/_quoting_c.c: In function ‘__Pyx_ReraiseException’:
      yarl/_quoting_c.c:9349:20: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_type’
       9349 |     type = exc_info->exc_type;
            |                    ^~
      yarl/_quoting_c.c:9351:18: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_traceback’
       9351 |     tb = exc_info->exc_traceback;
            |                  ^~
      yarl/_quoting_c.c: In function ‘__Pyx_CreateCodeObjectForTraceback’:
      yarl/_quoting_c.c:10264:9: warning: passing argument 14 of ‘PyCode_New’ makes pointer from integer without a cast [-Wint-conversion]
      10264 |         py_line,
            |         ^~~~~~~
            |         |
            |         int
      yarl/_quoting_c.c:320:72: note: in definition of macro ‘__Pyx_PyCode_New’
        320 |           PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
            |                                                                        ^~~~~
      In file included from /usr/local/include/python3.11/code.h:11,
                       from /usr/local/include/python3.11/Python.h:71,
                       from yarl/_quoting_c.c:6:
      /usr/local/include/python3.11/cpython/code.h:153:28: note: expected ‘PyObject *’ {aka ‘struct _object *’} but argument is of typeint153 | PyAPI_FUNC(PyCodeObject *) PyCode_New(
            |                            ^~~~~~~~~~
      yarl/_quoting_c.c:10265:9: warning: passing argument 15 of ‘PyCode_New’ makes integer from pointer without a cast [-Wint-conversion]
      10265 |         __pyx_empty_bytes  /*PyObject *lnotab*/
            |         ^~~~~~~~~~~~~~~~~
            |         |
            |         PyObject * {aka struct _object *}
      yarl/_quoting_c.c:320:79: note: in definition of macro ‘__Pyx_PyCode_New’
        320 |           PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
            |                                                                               ^~~~
      In file included from /usr/local/include/python3.11/code.h:11,
                       from /usr/local/include/python3.11/Python.h:71,
                       from yarl/_quoting_c.c:6:
      /usr/local/include/python3.11/cpython/code.h:153:28: note: expected ‘int’ but argument is of type ‘PyObject *’ {aka ‘struct _object *’}
        153 | PyAPI_FUNC(PyCodeObject *) PyCode_New(
            |                            ^~~~~~~~~~
      yarl/_quoting_c.c:320:11: error: too few arguments to function ‘PyCode_New’
        320 |           PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
            |           ^~~~~~~~~~
      yarl/_quoting_c.c:10250:15: note: in expansion of macro ‘__Pyx_PyCode_New’
      10250 |     py_code = __Pyx_PyCode_New(
            |               ^~~~~~~~~~~~~~~~
      In file included from /usr/local/include/python3.11/code.h:11,
                       from /usr/local/include/python3.11/Python.h:71,
                       from yarl/_quoting_c.c:6:
      /usr/local/include/python3.11/cpython/code.h:153:28: note: declared here
        153 | PyAPI_FUNC(PyCodeObject *) PyCode_New(
            |                            ^~~~~~~~~~
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for yarl
Failed to build yarl
ERROR: Could not build wheels for yarl, which is required to install pyproject.toml-based projects

Python Version

$ python --version
Python 3.11.0a6

multidict Version

$ python -m pip show multidict
Name: multidict
Version: 6.0.2
Summary: multidict implementation
Home-page: https://github.com/aio-libs/multidict
Author: Andrew Svetlov
Author-email: andrew.svetlov@gmail.com
License: Apache 2
Location: /home/felixx/repo/yarl/.yarl-3.11/lib/python3.11/site-packages
Requires: 
Required-by: 

yarl Version

$ python -m pip show yarl

OS

Windows, Linux

Additional context

No response

Code of Conduct

  • I agree to follow the aio-libs Code of Conduct

This should be probably a new feature, sorry.

I've been able to resolve this by re-cythonizing with Cython 0.29.30 (0.29.29 is also fine but it has regressions).

Sorry, didn't immediately realise the other issue was not in this project but for aiohttp.

So if Cython 0.29.30 can solve this we'd need to update the release process to make sure the right Cython version is used.

Is it enough to bump cython in requirements? (see #725).

It should be. There won't be a release until #698 is resolved; I've already poked the dev that needs to merge my updates to the release infra that fixes that issue.

I've updated the CI to at least cover 3.11 with Cython. The test passes.

Please rerun those tests on Python 3.11-beta.4.

An on-demand GitHub Action...

name: python_3_11-dev
on:
  workflow_dispatch:
jobs:
  python_3_11-dev:
    strategy:
      fail-fast: false
      matrix:
        package:
          - yarl  # Fails
          - git+https://github.com/aio-libs/yarl.git  # Fails
    runs-on: ubuntu-latest
    steps:
      - uses: actions/setup-python@v4
        with:
          python-version: 3.11-dev
      - run: python3.11 -m pip install --upgrade pip wheel
      - run: python3.11 -m pip install --upgrade Cython==0.29.30
      - run: python3.11 -m pip install ${{ matrix.package }}

FTR, I've just found out that there was an unsuccessful attempt to release yarl @ https://github.com/aio-libs/yarl/actions/runs/1841654316. The logs are unavailable so I don't know why that failed.
FWIW, that release attempt probably didn't use the right Cython version anyway: https://github.com/aio-libs/yarl/blob/v1.8.0/requirements/cython.txt.
I'll try to re-run the workflow and see what happens.

Sorry, didn't immediately realise the other issue was not in this project but for aiohttp.

So if Cython 0.29.30 can solve this we'd need to update the release process to make sure the right Cython version is used.

Not really, Cython is pinned and the requirements file is checked into this repo. Just need a new release.

https://github.com/aio-libs/yarl/actions/runs/2767173273 failed because linters in that commit referenced git://github.com/... so I've put 42a5e2a on top and re-tagged it with v1.8.0.

so I've put 42a5e2a on top and re-tagged it with v1.8.0.

Looks like 401ffb1 is also needed.

Looks like 401ffb1 is also needed.

Oh... #698 / aio-libs/get-releasenote#36.

I'll probably get to approve this deployment https://github.com/aio-libs/yarl/actions/runs/2771045488 in the morning since it's already late, and it'll take 1.5hrs to build non-x86 wheels under QEMU. If that works, it'll mean that the release pipeline is fixed, and I'll get to try rebuilding yarl with newer Cython (since I've only cherry-picked minimal patches on top of the previously tagged commit v1.8.0). Stay tuned.

If that works

It didn't. Failed on the changelog check...

ERROR long_description has syntax errors in markup and would not be rendered on PyPI.
line 233: Error: Unknown interpreted text role "meth".

https://github.com/aio-libs/yarl/blob/master/setup.py#L45-L46

https://github.com/aio-libs/yarl/search?q=meth

Yes, I know.

Hopefully, this is the last patch needed: https://github.com/aio-libs/yarl/actions/runs/2776601865.

@webknjaz Many thanks 🌟

@felixxm it's probably still used an older than necessary Cython. The next step would be to bump stuff and maybe release v1.8.1 (I'll need to check the diff and maybe PRs to decide on the version).

@felixxm it's probably still used an older than necessary Cython. The next step would be to bump stuff and maybe release v1.8.1 (I'll need to check the diff and maybe PRs to decide on the version).

True, I still get errors but different:

  C:\hostedtoolcache\windows\Python\3.11.0-beta.5\x64\include\cpython/pystate.h(55): note: see declaration of '_err_stackitem'
  yarl/_quoting_c.c(9272): error C2039: 'exc_traceback': is not a member of '_err_stackitem'
  C:\hostedtoolcache\windows\Python\3.11.0-beta.5\x64\include\cpython/pystate.h(55): note: see declaration of '_err_stackitem'
  yarl/_quoting_c.c(9273): error C2039: 'exc_type': is not a member of '_err_stackitem'
  C:\hostedtoolcache\windows\Python\3.11.0-beta.5\x64\include\cpython/pystate.h(55): note: see declaration of '_err_stackitem'
  yarl/_quoting_c.c(9275): error C2039: 'exc_traceback': is not a member of '_err_stackitem'
  C:\hostedtoolcache\windows\Python\3.11.0-beta.5\x64\include\cpython/pystate.h(55): note: see declaration of '_err_stackitem'
  yarl/_quoting_c.c(9308): error C2039: 'exc_type': is not a member of '_err_stackitem'
  C:\hostedtoolcache\windows\Python\3.11.0-beta.5\x64\include\cpython/pystate.h(55): note: see declaration of '_err_stackitem'
  yarl/_quoting_c.c(9310): error C2039: 'exc_traceback': is not a member of '_err_stackitem'
  C:\hostedtoolcache\windows\Python\3.11.0-beta.5\x64\include\cpython/pystate.h(55): note: see declaration of '_err_stackitem'
  yarl/_quoting_c.c(9311): error C2039: 'exc_type': is not a member of '_err_stackitem'
  C:\hostedtoolcache\windows\Python\3.11.0-beta.5\x64\include\cpython/pystate.h(55): note: see declaration of '_err_stackitem'
  yarl/_quoting_c.c(9313): error C2039: 'exc_traceback': is not a member of '_err_stackitem'
  C:\hostedtoolcache\windows\Python\3.11.0-beta.5\x64\include\cpython/pystate.h(55): note: see declaration of '_err_stackitem'
  yarl/_quoting_c.c(9343): error C2039: 'exc_type': is not a member of '_err_stackitem'
  C:\hostedtoolcache\windows\Python\3.11.0-beta.5\x64\include\cpython/pystate.h(55): note: see declaration of '_err_stackitem'
  yarl/_quoting_c.c(9343): error C2039: 'exc_type': is not a member of '_err_stackitem'
  C:\hostedtoolcache\windows\Python\3.11.0-beta.5\x64\include\cpython/pystate.h(55): note: see declaration of '_err_stackitem'
  yarl/_quoting_c.c(9357): error C2039: 'exc_type': is not a member of '_err_stackitem'
  C:\hostedtoolcache\windows\Python\3.11.0-beta.5\x64\include\cpython/pystate.h(55): note: see declaration of '_err_stackitem'
  yarl/_quoting_c.c(9359): error C2039: 'exc_traceback': is not a member of '_err_stackitem'
  C:\hostedtoolcache\windows\Python\3.11.0-beta.5\x64\include\cpython/pystate.h(55): note: see declaration of '_err_stackitem'
  yarl/_quoting_c.c(9373): error C2039: 'exc_type': is not a member of '_err_stackitem'
  C:\hostedtoolcache\windows\Python\3.11.0-beta.5\x64\include\cpython/pystate.h(55): note: see declaration of '_err_stackitem'
  yarl/_quoting_c.c(9375): error C2039: 'exc_traceback': is not a member of '_err_stackitem'
  C:\hostedtoolcache\windows\Python\3.11.0-beta.5\x64\include\cpython/pystate.h(55): note: see declaration of '_err_stackitem'
  yarl/_quoting_c.c(9376): error C2039: 'exc_type': is not a member of '_err_stackitem'
  C:\hostedtoolcache\windows\Python\3.11.0-beta.5\x64\include\cpython/pystate.h(55): note: see declaration of '_err_stackitem'
  yarl/_quoting_c.c(9378): error C2039: 'exc_traceback': is not a member of '_err_stackitem'
  C:\hostedtoolcache\windows\Python\3.11.0-beta.5\x64\include\cpython/pystate.h(55): note: see declaration of '_err_stackitem'
  yarl/_quoting_c.c(9419): error C2039: 'exc_type': is not a member of '_err_stackitem'
  C:\hostedtoolcache\windows\Python\3.11.0-beta.5\x64\include\cpython/pystate.h(55): note: see declaration of '_err_stackitem'
  yarl/_quoting_c.c(9421): error C2039: 'exc_traceback': is not a member of '_err_stackitem'
  C:\hostedtoolcache\windows\Python\3.11.0-beta.5\x64\include\cpython/pystate.h(55): note: see declaration of '_err_stackitem'
  yarl/_quoting_c.c(10373): error C2037: left of 'f_lineno' specifies undefined struct/union '_frame'
  error: command 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Tools\\MSVC\\14.32.31326\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
  [end of output]
  

I still get errors

FWIW that sdist for v1.8.0 was built with Cython v0.29.27: https://github.com/aio-libs/yarl/runs/7616579153?check_suite_focus=true#step:6:53.

The just-released yarl v1.8.1 is cythonized with v0.29.32: https://github.com/aio-libs/yarl/actions/runs/2777992456. Maybe check if that fixes it?

https://pypi.org/project/yarl/1.8.1/

C:\hostedtoolcache\windows\Python\3.11.0-beta.5

By the way, I've added more jobs with this CPython version to the CI and made them "voting". Everything passes on our side in the present envs at least.

It works! 🚀 Thanks 🥇

Now, we're waiting for Python 3.11 compatible versions of frozenlist and aiohttp.

My sense is that frozenlist merely requires upgraded dependencies in requirements/ci.txt.
aio-libs/frozenlist#306 (comment)

It works! 🚀 Thanks 🥇

Now, we're waiting for Python 3.11 compatible versions of frozenlist and aiohttp.

Great, I'll be prioritizing resolving these issues starting with frozenlist. Although, I don't know what state its release process is so it may take some time.
Let's track it @ aio-libs/frozenlist#305.