pytries / marisa-trie

Static memory-efficient Trie-like structures for Python based on marisa-trie C++ library.
https://marisa-trie.readthedocs.io/en/latest/
MIT License
1.02k stars 91 forks source link

regenerate cpp files with cython for Python 3.11 #80

Closed lucidfrontier45 closed 1 year ago

lucidfrontier45 commented 1 year ago

The current cpp codes are incompatible with Python 3.11 due to Cython's bug. https://github.com/cython/cython/issues/4461

build fails as follows.

src/agent.cpp:198:12: fatal error: longintrepr.h: No such file or directory
  198 |   #include "longintrepr.h"
      |            ^~~~~~~~~~~~~~~
compilation terminated.
error: command '/usr/bin/gcc' failed with exit code 1

Luckly the latest Cython has already fixed this issue. I just regenerated cpp files with latest Cython 0.29.32.

I tested the newly generated cpp files against python 3.8-3.11rc2. All builds it without any error and unittest also passed.

I also added -3 option to remove warnings. If Python 2.7 support is must, I'll regenerate without this option.

BoboTiG commented 1 year ago

Thanks for the patch @lucidfrontier45 !

Let's move forward, and remove unsupported Python versions from setup.py :)

It will:

BoboTiG commented 1 year ago

No sorry, actually, let's keep Python 2.7 compatibility. Cython is still supporting that, and it doesn't hurt to do the same here.

lucidfrontier45 commented 1 year ago

@BoboTiG

OK, I regenerated with "-2" option. Since in next major version of Cython, the default language level will change to 3, I also add explicit "-2" option in the update_cpp.sh .

BoboTiG commented 1 year ago

Perfect, thanks!