Closed
Labels
Description
Describe the bug
If running under Python 3.11 (beta 2), the pydicom tests fail on loading with the callstack
...
..\valuerep.py:770: in <module>
class TM(_DateTimeBase, datetime.time):
..\valuerep.py:775: in TM
_RE_TIME = re.compile(
C:\Python\Python311\Lib\re\__init__.py:225: in compile
return _compile(pattern, flags)
C:\Python\Python311\Lib\re\__init__.py:273: in _compile
p = _compiler.compile(pattern, flags)
C:\Python\Python311\Lib\re\_compiler.py:775: in compile
return _sre.compile(
E RuntimeError: invalid SRE code
The problem seems to be this regex (which I wrote):
_RE_TIME = re.compile(
r"(?P<h>^([01][0-9]|2[0-3]))"
r"((?P<m>([0-5][0-9]))?"
r"(?(5)(?P<s>([0-5][0-9]|60))?)"
r"(?(7)(\.(?P<ms>([0-9]{1,6})?))?))$"
)I have no idea what is wrong with the regex yet.
Expected behavior
Tests shall run.
Steps To Reproduce
Run Python tests under Python 3.11 (in GH actions: Python version "3.11-dev").
Happens under all environements (Windows, Linux, MacOs)
It could be a Python problem, but I doubt that at this stage. Shall be fixed before the Python 3.11 release.
Activity
[-]Tests are not running in Python 3.11[/-][+]Pydicom not running under Python 3.11[/+]Add CI builds for Python 3.11
Add CI builds for Python 3.11
Add CI builds for Python 3.11 (#1659)
Waszker commentedon Oct 26, 2022
Hi @mrbean-bremen I think the changes introduced by the PR fixing this issue should be reverted once Python 3.11 fixes
re.compilebug: python/cpython#98740I think that the previous regex is more "correct".
Let me know what you think and if you'd like me to inform you once the fix is released.
mrbean-bremen commentedon Oct 26, 2022
Thanks - I'm traveling right now and will have a look when I'm back in a couple of days.
mrbean-bremen commentedon Oct 28, 2022
See my comment in the PR.
Waszker commentedon Oct 29, 2022
Thanks, as I've already replied in the PR I misread the new regex and mistakenly suggested that it might be incorrect. I'm sorry for the confusion.