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

Brocken compatibility with Python < 3.11 #42

Closed
evgeniyDorogoy opened this issue Mar 30, 2023 · 1 comment
Closed

Brocken compatibility with Python < 3.11 #42

evgeniyDorogoy opened this issue Mar 30, 2023 · 1 comment

Comments

@evgeniyDorogoy
Copy link

evgeniyDorogoy commented Mar 30, 2023

It appears that a recent change to the library has caused some compatibility issues with older versions of Python.

Specifically, the commit at https://github.com/andreasvc/pyre2/commit/01c73c9dac4f06c0e1e41519fa8f874bf02fb1b0 has broken backward compatibility for Python versions lower than 3.11.

When attempting to import the library with the line import re2, an error is encountered that results in the traceback shown below:

  File "/Users/evgeniydorogoy/.pyenv/versions/3.8.5/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/Users/evgeniydorogoy/Projects/api/admin.py", line 6, in <module>
    from lexicockpit.api.forms import PatternForm, TicketForm
  File "/Users/evgeniydorogoy/Projects/api/forms.py", line 18, in <module>
    from lexicockpit.backend import validation
  File "/Users/evgeniydorogoy/Projects/backend/validation.py", line 5, in <module>
    import re2
  File "re2.pyx", line 132, in init re2
AttributeError: module 'enum' has no attribute 'global_enum'

Fortunately, for those who want to use the library with older Python versions, this issue can be resolved by reverting to the previous commit at https://github.com/andreasvc/pyre2/commit/8d853ab5076e959eb980ebd2ddbd338f491b58cd.

@andreasvc
Copy link
Owner

Thanks for the heads up. That commit needs a check for a minimal Python version. You're welcome to make a pull request ;)

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

No branches or pull requests

2 participants