whtsky/bencoder.pyx

Python 3.11 compatibility, #include "longintrepr.h" is invalid

roshii opened this issue · 5 comments

https://docs.python.org/3.11/whatsnew/3.11.html documents that longintrepr.h can no longer be included, but just patching this out is insufficient to fix compilation failures.

bencoder.pyx fails to build on 3.11 due to this exact reason. Can this be fixed somehow?

> [builder 3/3] RUN pip wheel --no-cache --no-deps  bencoder.pyx:                                                        
#0 24.14   Building wheel for bencoder.pyx (pyproject.toml): started
#0 24.50   Building wheel for bencoder.pyx (pyproject.toml): finished with status 'error'
#0 24.51   error: subprocess-exited-with-error
#0 24.51   
#0 24.51   × Building wheel for bencoder.pyx (pyproject.toml) did not run successfully.
#0 24.51   │ exit code: 1
#0 24.51   ╰─> [14 lines of output]
#0 24.51       Compiling bencoder.pyx because it changed.
#0 24.51       [1/1] Cythonizing bencoder.pyx
#0 24.51       running bdist_wheel
#0 24.51       running build
#0 24.51       running build_ext
#0 24.51       building 'bencoder' extension
#0 24.51       creating build
#0 24.51       creating build/temp.linux-x86_64-cpython-311
#0 24.51       gcc -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/local/include/python3.11 -c bencoder.c -o build/temp.linux-x86_64-cpython-311/bencoder.o -O3
#0 24.51       bencoder.c:211:12: fatal error: longintrepr.h: No such file or directory
#0 24.51         211 |   #include "longintrepr.h"
#0 24.51             |            ^~~~~~~~~~~~~~~
#0 24.51       compilation terminated.
#0 24.51       error: command '/usr/bin/gcc' failed with exit code 1
#0 24.51       [end of output]
#0 24.51   
#0 24.51   note: This error originates from a subprocess, and is likely not a problem with pip.
#0 24.51   ERROR: Failed building wheel for bencoder.pyx

@roshii try this:

#113

docker run --rm -it --entrypoint bash python:3.11 -c 'pip install git+https://github.com/EsEnZeT/bencoder.pyx@patch-1'

CC: @whtsky

'Successfully built bencoder.pyx'

Works perfectly, thanks

Thanks for reporting & fix.
I'll update CI and hopefully release a new version to include wheels for 3.11 this week

Thanks @whtsky !
I just forgot to update test-requirements.txt