You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
regex format checker crashes with RecursionError on deeply nested patterns #1538
The regex format checker is registered with raises=re.error, but re.compile raises RecursionError (not an re.error subclass) when the pattern nesting exceeds the C stack limit. This causes an uncaught exception to propagate from the validator instead of reporting the instance as invalid.
The issue is that re.compile raises RecursionError (not an re.error subclass) when the pattern nesting exceeds the C stack limit. This causes an uncaught exception to propagate from the validator instead of reporting the instance as invalid.
The fix is to catch RecursionError in the regex format checker, similar to how OverflowError is handled in #1526.
Activity
Report regex compile failures as invalid format, not crashes.
DawnofGenX commentedon Oct 5, 2026
I'd like to work on this.
The issue is that
re.compileraisesRecursionError(not anre.errorsubclass) when the pattern nesting exceeds the C stack limit. This causes an uncaught exception to propagate from the validator instead of reporting the instance as invalid.The fix is to catch
RecursionErrorin theregexformat checker, similar to howOverflowErroris handled in #1526.I'll add a regression test and implement the fix.