Skip to content

Commit

Permalink
xeger: avoid deprecated sre_parse module in python-3.11+ (#28)
Browse files Browse the repository at this point in the history
* xeger: avoid deprecated sre_parse module in python-3.11+

The undocumented sre_parse module got deprecated in Python 3.11 which leads
to build/test failures on Linux distributions making use of this version, e.g.
Ubuntu 23.04.

See bpo-47152: python/cpython#91308

* tox: enable Python 3.11

---------

Co-authored-by: Brendan McCollam <brendan@mccoll.am>
  • Loading branch information
slyon and bjmc authored Apr 18, 2023
1 parent 95c7940 commit b4df740
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion rstr/xeger.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import random
import sre_parse
import string
from itertools import chain
import typing
Expand All @@ -10,6 +9,11 @@
if typing.TYPE_CHECKING:
from rstr.rstr_base import _Random

try:
import re._parser as sre_parse # type: ignore[import]
except ImportError: # Python < 3.11
import sre_parse # type: ignore[no-redef]


# The * and + characters in a regular expression
# match up to any number of repeats in theory,
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = pypy38,pyp39,py37,py38,py39,py310,py311,typing
envlist = pypy38,pypy39,py37,py38,py39,py310,py311,typing
skipsdist = true

[testenv]
Expand Down

0 comments on commit b4df740

Please sign in to comment.