Skip to content
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

Fail to build with Python 3.13 #862

Closed
littlebutt opened this issue Jul 16, 2023 · 7 comments · Fixed by #864
Closed

Fail to build with Python 3.13 #862

littlebutt opened this issue Jul 16, 2023 · 7 comments · Fixed by #864
Assignees

Comments

@littlebutt
Copy link

Long story short

The package cannot be built on Python 3.13.

Expected behaviour

The package can be built successfully when running pip install multidict.

Actual behaviour

Building wheels for collected packages: multidict
Building wheel for multidict (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for multidict (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [116 lines of output]
*********************
* Accelerated build *
*********************
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-cpython-313
......
"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\Users\luoga\Desktop\cpython\include -IC:\Users\luoga\Desktop\cpython\PC -IC:\Users\luoga\Desktop\cpython\PC "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\ATLMFC\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\VS\include" "-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\um" "-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\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.7.2\include\um" /Tcmultidict/_multidict.c /Fobuild\temp.win-amd64-cpython-313\Release\multidict/_multidict.obj -O2
_multidict.c
C:\Users\luoga\AppData\Local\Temp\pip-install-v6wr08bw\multidict_fb6642d302954696ac7c69c89da3bbd1\multidict_multilib/istr.h(46): warning C4013: “_PyObject_CallMethodId” Undifined, Suppose returning int
......
"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\bin\HostX86\x64\link.exe" /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:C:\Users\luoga\Desktop\cpython\libs /LIBPATH:C:\Users\luoga\Desktop\cpython /LIBPATH:C:\Users\luoga\Desktop\cpython\PCbuild\amd64 "/LIBPATH:C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\ATLMFC\lib\x64" "/LIBPATH:C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\lib\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.7.2\lib\um\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.22000.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.22000.0\um\x64" /EXPORT:PyInit__multidict build\temp.win-amd64-cpython-313\Release\multidict/_multidict.obj /OUT:build\lib.win-amd64-cpython-313\multidict_multidict.cp313-win_amd64.pyd /IMPLIB:build\temp.win-amd64-cpython-313\Release\multidict_multidict.cp313-win_amd64.lib
Building lib build\temp.win-amd64-cpython-313\Release\multidict_multidict.cp313-win_amd64.lib and object build\temp.win-amd64-cpython-313\Release\multidict_multidict.cp313-win_amd64.exp
_multidict.obj : error LNK2001: Cannot resolve external symbol Py_TRASHCAN_SAFE_END
_multidict.obj : error LNK2001: Cannot resolve external symbol Py_TRASHCAN_SAFE_BEGIN
_multidict.obj : error LNK2001: Cannot resolve external symbol _PyObject_CallMethodId

Steps to reproduce

pip install multidict

Your environment

  • Windows 10
  • Python 3.13
  • pip 23.2
@littlebutt
Copy link
Author

Hi @asvetlov . I wish I could find you right. I found the building crash above and it is caused by this PR in CPython. Is it necessary to fix it? Thank you.

@tacaswell
Copy link

xref python/cpython#112136

Some of the removals have been reverted, but it appears that the _PyArg_Parser related chages have not.

@tacaswell
Copy link

I am still seeing failures locally with with Python v3.13.0a2-409-gacf3bcc886 (current main) and multidict v6.0.4-40-g780a1e1 (current master)

      gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall -DCYTHON_FAST_THREAD_STATE=0 -fPIC -I/home/tcaswell/.virtualenvs/cp_main/include -I/home/tcaswell/.pybuild/cp_main/include/python3.13 -c multidict/_multidict.c -o build/temp.linux-x86_64-cpython-313/multidict/_multidict.o -O2 -std=c99 -Wall -Wsign-compare -Wconversion -fno-strict-aliasing -pedantic
      In file included from /home/tcaswell/.pybuild/cp_main/include/python3.13/Python.h:121,
                       from multidict/_multidict.c:1:
      /home/tcaswell/.pybuild/cp_main/include/python3.13/cpython/optimizer.h:53:3: warning: redefinition of typedef ‘_PyOptimizerObject’ [-Wpedantic]
         53 | } _PyOptimizerObject;
            |   ^~~~~~~~~~~~~~~~~~
      /home/tcaswell/.pybuild/cp_main/include/python3.13/cpython/optimizer.h:40:35: note: previous declaration of ‘_PyOptimizerObject’ with type ‘_PyOptimizerObject’
         40 | typedef struct _PyOptimizerObject _PyOptimizerObject;
            |                                   ^~~~~~~~~~~~~~~~~~
      multidict/_multidict.c: In function ‘multidict_getall’:
      multidict/_multidict.c:452:12: error: unknown type name ‘_PyArg_Parser’
        452 |     static _PyArg_Parser _parser = {"O|O:getall", _keywords, 0};
            |            ^~~~~~~~~~~~~
      multidict/_multidict.c:452:37: warning: initialization of ‘int’ from ‘char *’ makes integer from pointer without a cast [-Wint-conversion]
        452 |     static _PyArg_Parser _parser = {"O|O:getall", _keywords, 0};
            |                                     ^~~~~~~~~~~~
      multidict/_multidict.c:452:37: note: (near initialization for ‘_parser’)
      multidict/_multidict.c:452:37: error: initializer element is not computable at load time
      multidict/_multidict.c:452:37: note: (near initialization for ‘_parser’)
      multidict/_multidict.c:452:51: warning: excess elements in scalar initializer
        452 |     static _PyArg_Parser _parser = {"O|O:getall", _keywords, 0};
            |                                                   ^~~~~~~~~
      multidict/_multidict.c:452:51: note: (near initialization for ‘_parser’)
      multidict/_multidict.c:452:62: warning: excess elements in scalar initializer
        452 |     static _PyArg_Parser _parser = {"O|O:getall", _keywords, 0};
            |                                                              ^
      multidict/_multidict.c:452:62: note: (near initialization for ‘_parser’)
      multidict/_multidict.c:453:10: warning: implicit declaration of function ‘_PyArg_ParseStackAndKeywords’; did you mean ‘PyArg_ParseTupleAndKeywords’? [-Wimplicit-function-declaration]
        453 |     if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
            |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
            |          PyArg_ParseTupleAndKeywords
      multidict/_multidict.c: In function ‘multidict_getone’:
      multidict/_multidict.c:497:12: error: unknown type name ‘_PyArg_Parser’
        497 |     static _PyArg_Parser _parser = {"O|O:getone", _keywords, 0};
            |            ^~~~~~~~~~~~~
      multidict/_multidict.c:497:37: warning: initialization of ‘int’ from ‘char *’ makes integer from pointer without a cast [-Wint-conversion]
        497 |     static _PyArg_Parser _parser = {"O|O:getone", _keywords, 0};
            |                                     ^~~~~~~~~~~~
      multidict/_multidict.c:497:37: note: (near initialization for ‘_parser’)
      multidict/_multidict.c:497:37: error: initializer element is not computable at load time
      multidict/_multidict.c:497:37: note: (near initialization for ‘_parser’)
      multidict/_multidict.c:497:51: warning: excess elements in scalar initializer
        497 |     static _PyArg_Parser _parser = {"O|O:getone", _keywords, 0};
            |                                                   ^~~~~~~~~
      multidict/_multidict.c:497:51: note: (near initialization for ‘_parser’)
      multidict/_multidict.c:497:62: warning: excess elements in scalar initializer
        497 |     static _PyArg_Parser _parser = {"O|O:getone", _keywords, 0};
            |                                                              ^
      multidict/_multidict.c:497:62: note: (near initialization for ‘_parser’)
      multidict/_multidict.c: In function ‘multidict_get’:
      multidict/_multidict.c:532:12: error: unknown type name ‘_PyArg_Parser’
        532 |     static _PyArg_Parser _parser = {"O|O:get", _keywords, 0};
            |            ^~~~~~~~~~~~~
      multidict/_multidict.c:532:37: warning: initialization of ‘int’ from ‘char *’ makes integer from pointer without a cast [-Wint-conversion]
        532 |     static _PyArg_Parser _parser = {"O|O:get", _keywords, 0};
            |                                     ^~~~~~~~~
      multidict/_multidict.c:532:37: note: (near initialization for ‘_parser’)
      multidict/_multidict.c:532:37: error: initializer element is not computable at load time
      multidict/_multidict.c:532:37: note: (near initialization for ‘_parser’)
      multidict/_multidict.c:532:48: warning: excess elements in scalar initializer
        532 |     static _PyArg_Parser _parser = {"O|O:get", _keywords, 0};
            |                                                ^~~~~~~~~
      multidict/_multidict.c:532:48: note: (near initialization for ‘_parser’)
      multidict/_multidict.c:532:59: warning: excess elements in scalar initializer
        532 |     static _PyArg_Parser _parser = {"O|O:get", _keywords, 0};
            |                                                           ^
      multidict/_multidict.c:532:59: note: (near initialization for ‘_parser’)
      multidict/_multidict.c: In function ‘multidict_add’:
      multidict/_multidict.c:782:12: error: unknown type name ‘_PyArg_Parser’
        782 |     static _PyArg_Parser _parser = {"OO:add", _keywords, 0};
            |            ^~~~~~~~~~~~~
      multidict/_multidict.c:782:37: warning: initialization of ‘int’ from ‘char *’ makes integer from pointer without a cast [-Wint-conversion]
        782 |     static _PyArg_Parser _parser = {"OO:add", _keywords, 0};
            |                                     ^~~~~~~~
      multidict/_multidict.c:782:37: note: (near initialization for ‘_parser’)
      multidict/_multidict.c:782:37: error: initializer element is not computable at load time
      multidict/_multidict.c:782:37: note: (near initialization for ‘_parser’)
      multidict/_multidict.c:782:47: warning: excess elements in scalar initializer
        782 |     static _PyArg_Parser _parser = {"OO:add", _keywords, 0};
            |                                               ^~~~~~~~~
      multidict/_multidict.c:782:47: note: (near initialization for ‘_parser’)
      multidict/_multidict.c:782:58: warning: excess elements in scalar initializer
        782 |     static _PyArg_Parser _parser = {"OO:add", _keywords, 0};
            |                                                          ^
      multidict/_multidict.c:782:58: note: (near initialization for ‘_parser’)
      multidict/_multidict.c: In function ‘multidict_setdefault’:
      multidict/_multidict.c:844:12: error: unknown type name ‘_PyArg_Parser’
        844 |     static _PyArg_Parser _parser = {"O|O:setdefault", _keywords, 0};
            |            ^~~~~~~~~~~~~
      multidict/_multidict.c:844:37: warning: initialization of ‘int’ from ‘char *’ makes integer from pointer without a cast [-Wint-conversion]
        844 |     static _PyArg_Parser _parser = {"O|O:setdefault", _keywords, 0};
            |                                     ^~~~~~~~~~~~~~~~
      multidict/_multidict.c:844:37: note: (near initialization for ‘_parser’)
      multidict/_multidict.c:844:37: error: initializer element is not computable at load time
      multidict/_multidict.c:844:37: note: (near initialization for ‘_parser’)
      multidict/_multidict.c:844:55: warning: excess elements in scalar initializer
        844 |     static _PyArg_Parser _parser = {"O|O:setdefault", _keywords, 0};
            |                                                       ^~~~~~~~~
      multidict/_multidict.c:844:55: note: (near initialization for ‘_parser’)
      multidict/_multidict.c:844:66: warning: excess elements in scalar initializer
        844 |     static _PyArg_Parser _parser = {"O|O:setdefault", _keywords, 0};
            |                                                                  ^
      multidict/_multidict.c:844:66: note: (near initialization for ‘_parser’)
      multidict/_multidict.c: In function ‘multidict_popone’:
      multidict/_multidict.c:880:12: error: unknown type name ‘_PyArg_Parser’
        880 |     static _PyArg_Parser _parser = {"O|O:popone", _keywords, 0};
            |            ^~~~~~~~~~~~~
      multidict/_multidict.c:880:37: warning: initialization of ‘int’ from ‘char *’ makes integer from pointer without a cast [-Wint-conversion]
        880 |     static _PyArg_Parser _parser = {"O|O:popone", _keywords, 0};
            |                                     ^~~~~~~~~~~~
      multidict/_multidict.c:880:37: note: (near initialization for ‘_parser’)
      multidict/_multidict.c:880:37: error: initializer element is not computable at load time
      multidict/_multidict.c:880:37: note: (near initialization for ‘_parser’)
      multidict/_multidict.c:880:51: warning: excess elements in scalar initializer
        880 |     static _PyArg_Parser _parser = {"O|O:popone", _keywords, 0};
            |                                                   ^~~~~~~~~
      multidict/_multidict.c:880:51: note: (near initialization for ‘_parser’)
      multidict/_multidict.c:880:62: warning: excess elements in scalar initializer
        880 |     static _PyArg_Parser _parser = {"O|O:popone", _keywords, 0};
            |                                                              ^
      multidict/_multidict.c:880:62: note: (near initialization for ‘_parser’)
      multidict/_multidict.c: In function ‘multidict_pop’:
      multidict/_multidict.c:927:12: error: unknown type name ‘_PyArg_Parser’
        927 |     static _PyArg_Parser _parser = {"O|O:pop", _keywords, 0};
            |            ^~~~~~~~~~~~~
      multidict/_multidict.c:927:37: warning: initialization of ‘int’ from ‘char *’ makes integer from pointer without a cast [-Wint-conversion]
        927 |     static _PyArg_Parser _parser = {"O|O:pop", _keywords, 0};
            |                                     ^~~~~~~~~
      multidict/_multidict.c:927:37: note: (near initialization for ‘_parser’)
      multidict/_multidict.c:927:37: error: initializer element is not computable at load time
      multidict/_multidict.c:927:37: note: (near initialization for ‘_parser’)
      multidict/_multidict.c:927:48: warning: excess elements in scalar initializer
        927 |     static _PyArg_Parser _parser = {"O|O:pop", _keywords, 0};
            |                                                ^~~~~~~~~
      multidict/_multidict.c:927:48: note: (near initialization for ‘_parser’)
      multidict/_multidict.c:927:59: warning: excess elements in scalar initializer
        927 |     static _PyArg_Parser _parser = {"O|O:pop", _keywords, 0};
            |                                                           ^
      multidict/_multidict.c:927:59: note: (near initialization for ‘_parser’)
      multidict/_multidict.c: In function ‘multidict_popall’:
      multidict/_multidict.c:975:12: error: unknown type name ‘_PyArg_Parser’
        975 |     static _PyArg_Parser _parser = {"O|O:popall", _keywords, 0};
            |            ^~~~~~~~~~~~~
      multidict/_multidict.c:975:37: warning: initialization of ‘int’ from ‘char *’ makes integer from pointer without a cast [-Wint-conversion]
        975 |     static _PyArg_Parser _parser = {"O|O:popall", _keywords, 0};
            |                                     ^~~~~~~~~~~~
      multidict/_multidict.c:975:37: note: (near initialization for ‘_parser’)
      multidict/_multidict.c:975:37: error: initializer element is not computable at load time
      multidict/_multidict.c:975:37: note: (near initialization for ‘_parser’)
      multidict/_multidict.c:975:51: warning: excess elements in scalar initializer
        975 |     static _PyArg_Parser _parser = {"O|O:popall", _keywords, 0};
            |                                                   ^~~~~~~~~
      multidict/_multidict.c:975:51: note: (near initialization for ‘_parser’)
      multidict/_multidict.c:975:62: warning: excess elements in scalar initializer
        975 |     static _PyArg_Parser _parser = {"O|O:popall", _keywords, 0};
            |                                                              ^
      multidict/_multidict.c:975:62: note: (near initialization for ‘_parser’)
      error: command '/lib/ccache/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 multidict

I think this issue should be re-opened.

@webknjaz
Copy link
Member

Okay, that's reasonable. I guess I'll also extend the CI matrix with an experimental job for 3.13.

@webknjaz webknjaz reopened this Dec 26, 2023
@webknjaz
Copy link
Member

webknjaz commented Jan 5, 2024

So apparently, there's an upstream issue implying that there's no API replacement for _PyArg_Parser / _PyArg_ParseStackAndKeywords() so far: python/cpython#112136.

@webknjaz
Copy link
Member

webknjaz commented Jan 5, 2024

I wonder if reverting #681 would be an adequate workaround.

@webknjaz
Copy link
Member

webknjaz commented Jan 5, 2024

I wonder if reverting #681 would be an adequate workaround.

It does work: #909. Though, it should probably be made conditional on py313 so that the slow-down doesn't affect the current stable versions. Hopefully, the upstream will figure something out by the time it gets into the beta phase.

webknjaz added a commit that referenced this issue Jan 14, 2024
@webknjaz webknjaz self-assigned this Jan 16, 2024
@webknjaz webknjaz closed this as not planned Won't fix, can't repro, duplicate, stale Jan 16, 2024
@webknjaz webknjaz reopened this Jan 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants