← Back to DAGDA | Support | Source: https://github.com/pydicom/pydicom/issues/1658
Skip to content

Pydicom not running under Python 3.11 #1658

Closed

Description

@mrbean-bremen

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

  1. changed the title [-]Tests are not running in Python 3.11[/-] [+]Pydicom not running under Python 3.11[/+] on Jul 7, 2022
  2. added a commit that references this issue on Jul 8, 2022
    cfc6334
  3. added a commit that references this issue on Sep 20, 2022
    77824f1
  4. added a commit that references this issue on Oct 4, 2022
    183a3ef
  5. Waszker commented on Oct 26, 2022

    @Waszker

    Hi @mrbean-bremen I think the changes introduced by the PR fixing this issue should be reverted once Python 3.11 fixes re.compile bug: python/cpython#98740

    I 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.

  6. mrbean-bremen commented on Oct 26, 2022

    @mrbean-bremen
    MemberAuthor

    Thanks - I'm traveling right now and will have a look when I'm back in a couple of days.

  7. mrbean-bremen commented on Oct 28, 2022

    @mrbean-bremen
    MemberAuthor

    See my comment in the PR.

  8. Waszker commented on Oct 29, 2022

    @Waszker

    See my comment in the PR.

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions