Repository navigation
Conversation
Contributor
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 #551. Target branch: v2.
Python 3.15, 3.14.1 and 3.13.10 reject capturing groups in re.Scanner. This prevents even mistune.html("X") from running on the v2 branch.
Keep the existing scanner on runtimes that accept it. When initialization raises the specific capture-rejection error, compile rules separately and choose the earliest match, using rule order to break ties. This preserves local captures and backreferences without rebuilding regex bytecode. Keep the older scanner's default character-class behavior, handle overlapping candidates, and separate shortcut-reference handling from the two-group reference-link rule.
Add eight regression cases for captures, backreferences, priority, overlapping candidates, empty matches, character classes, unrelated initialization errors and the inherited scan contract. Add Python 3.15 to the existing v2 CI matrix.
Validation on Linux:
The fallback is not claimed to be uniformly faster. A small formatting-heavy sample took about 1.43x the older scanner's runtime; a plain-text sample and the CommonMark fixture corpus were faster in the same local check. The older-runtime path remains unchanged.
Python 2.7, PyPy and the full supported-version CI matrix were not run locally. Arbitrary third-party scanner subclasses are not covered by these tests.