Skip to content

Fix mistune 2 for python 3.15 - #553

Open
dairiki wants to merge 4 commits into
lepture:v2from
dairiki:fix.551-python315
Open

dairiki wants to merge 4 commits into
lepture:v2from
dairiki:fix.551-python315

Conversation

@dairiki

@dairiki dairiki commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

This fixes #551.

This is an alternative to #552.

Here, in order to bypass the restriction forbidding capturing groups in re.Scanner in Python 3.15, we essentially vendor re.Scanner from Python 3.14.

The code in re.Scanner has been essentially unchanged from Python 2.5 through Python 3.14, modulo changes in module naming and the introduction of the RegexFlag enum. The only change in Python 3.15 is the addition of the check for capturing groups. Since it's been so stable, I'm guessing that this vendoring of code from a previous release is fairly safe.

Note that crashes due to segmentation faults mentioned as the motivation for introducing the capturing group ban in Python 3.15 (python/cpython@fa9c3ee) seem only to be an issue when named capturing groups are used. (Ref: python/cpython#140797, python/cpython#140944.)

[Edited to add more detail about the history of re.Scanner.]

@codecov

codecov Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.05%. Comparing base (f1221ce) to head (9c4c68c).

Additional details and impacted files
@@            Coverage Diff             @@
##               v2     #553      +/-   ##
==========================================
+ Coverage   99.03%   99.05%   +0.01%     
==========================================
  Files          19       20       +1     
  Lines        1248     1270      +22     
==========================================
+ Hits         1236     1258      +22     
  Misses         12       12              
Flag Coverage Δ
unittests 99.05% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

These are mostly for code coverage.
@dairiki
dairiki marked this pull request as draft November 11, 2026 18:34
@dairiki
dairiki marked this pull request as ready for review November 11, 2026 18:34

This branch has not been deployed

No deployments
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

Successfully merging this pull request may close these issues.

1 participant