Skip to content

Commit

Permalink
Fix: Import error sre_parse
Browse files Browse the repository at this point in the history
sre_parse module was moved in py3.11
  • Loading branch information
sumslogs committed Dec 11, 2022
1 parent 9a66706 commit 44712bf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion exrex.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@
from future_builtins import map, range
except:
pass
from re import match, sre_parse, U
from re import match, U
try:
import re._parser as sre_parse
except ImportError: # Python < 3.11
from re import sre_parse
from itertools import tee
from random import choice, randint
from types import GeneratorType
Expand Down
6 changes: 5 additions & 1 deletion tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@

from exrex import generate, count, getone, CATEGORIES, simplify
import re
import sre_parse
try:
import re._parser as sre_parse
except ImportError: # Python < 3.11
from re import sre_parse
from sys import exit, version_info

IS_PY3 = version_info[0] == 3

RS = {
Expand Down

0 comments on commit 44712bf

Please sign in to comment.