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

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 type ‘int’
        153 | 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 type ‘int’
        153 | 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 type ‘int’
        153 | 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

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 6
  • Comments: 28 (28 by maintainers)

Commits related to this issue

Most upvoted comments

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 @ https://github.com/aio-libs/frozenlist/issues/305.

It works! 🚀 Thanks 🥇

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

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.

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.

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/