dhondta/python-tinyscript

module 're' has no attribute 'sre_parse'

geekworldtour opened this issue · 2 comments

tinyscript-1.27.2
Python 3.11.2 (tags/v3.11.2:878ead1, Feb 7 2023, 16:38:35) [MSC v.1934 64 bit (AMD64)] on win32

In IDLE, type:

from tinyscript import *
for p in ts.bruteforce_re("[a-z]{2}"):
    print(p)

Raises the following errors:

Traceback (most recent call last):
  File "<pyshell#20>", line 1, in <module>
    for p in ts.bruteforce_re("[a-z]{2}"):
  File "C:\Users\G\AppData\Roaming\Python\Python311\site-packages\tinyscript\helpers\attack.py", line 150, in bruteforce_re
    for c in re.strings(regex):
  File "C:\Users\G\AppData\Roaming\Python\Python311\site-packages\tinyscript\preimports\regex.py", line 210, in _generate_all_strings_from_regex
    for result in __gen_str_from_re(regex, __set_max(max_repeat), __set_any(any_set)):
  File "C:\Users\G\AppData\Roaming\Python\Python311\site-packages\tinyscript\preimports\regex.py", line 36, in __gen_str_from_re
    for state in (regex if parsed else re.sre_parse.parse(b(getattr(regex, "pattern", regex)))):
AttributeError: module 're' has no attribute 'sre_parse'

Hi @geekworldtour !
Thank you for bringing this to my attention. It appears that re.sre_parse was removed from Python 3.11.
I'll fix it in my next commit.

@geekworldtour Fixed in 1.27.3