miracle2k / django-assets

Django webassets integration.
BSD 2-Clause "Simplified" License
89 stars 79 forks source link

Fix issue with Python 3.11 #104

Open heyman opened 1 year ago

heyman commented 1 year ago

This fixes a crash on Python 3.11. Global flags in regexes must now be put at the beginning.

This is the error message for the exception that this PR fixes: re.error: global flags not at the start of the expression at position 12

Resolves #98

dbungert commented 1 year ago

Looks good, tested against Ubuntu Lunar + Python 3.11.

jayaddison commented 1 year ago

Applies the same fix as an accepted pull request for python-glob2 (miracle2k/python-glob2#22), and I too think this looks good.

heyman commented 1 year ago

Maybe someone with commit access could press the merge button?

jayaddison commented 1 year ago

@heyman could you update the description to add the text Resolves #98? (so that it can close that issue if-and-when merged)

heyman commented 1 year ago

@heyman could you update the description to add the text Resolves #98? (so that it can close that issue if-and-when merged)

Hmm, I can't reproduce the issue in #98. How can I reproduce it? (just want to verify that my PR actually fixes the issue)

jayaddison commented 1 year ago

Yep, good thinking. The following should replicate the problem:

fnmatch_filter(names=["__init__.py"], pat="*.py")

(on Python3.10, this emits a DeprecationWarning -- in Python 3.11, it fails -- your fix should address both, I think)

heyman commented 1 year ago

Ok, done!

Hopefully someone with commit access can press the merge button for this tiny fix that makes it possible to use the package on Python 3.11.

jayaddison commented 1 year ago

cc @miracle2k

vad commented 1 year ago

@heyman since this project is not maintained anymore, should we fork it under an organization and apply requires patches?

heyman commented 1 year ago

@vad I'm currently using my fork. I don't have time to make it any more "official" than that, but if someone would setup a proper fork (and perhaps even create a new PyPI package) I'd applaud it :).