Repository navigation
Conversation
xeger <= 0.4.0 imports the sre_parse module, which Python 3.15 removed, and its fallback (re.sre_parse) does not exist on Python 3.11+ either, so importing cyaron raised AttributeError. When that import fails, expose re._parser as sre_parse for the duration of the xeger import. Fixes luogu-dev#185 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #185.
On Python 3.15,
import cyaronfails.cyaron/string.pyimportsxeger, and xeger 0.4.0 (the latest release; the repo hasn't changed since 2023) does:Python 3.15 removed the
sre_parsemodule, andre.sre_parsedoesn't exist on 3.11+ either, so the import ends withAttributeError: module 're' has no attribute 'sre_parse'.This keeps the xeger dependency and only changes how it's imported: if
import xegerraises thatAttributeError,cyaron.stringregistersre._parser(the same parser, renamed in 3.11) assre_parse, imports xeger, then removes that entry again. On 3.6–3.14 the firstimport xegerstill succeeds, so nothing changes there.The new test
test_import_without_sre_parseblockssre_parseand re-importscyaron.string, so it reproduces the 3.15 failure on 3.11+ as well.Test results (Windows):
import cyaronandpython unit_test.pyfail with the error above; after, all 54 tests pass.string.pychange and passes with it; the full suite passes.test_output_gen_time_limit_not_exceeded(0.5 s limit) sometimes timed out on a busy machine with or without this change; it passed on rerun.CI doesn't run 3.15 yet. I can add it in a follow-up if you want.
I used Claude Code to write this change.