[issue44929] Some RegexFlag cannot be printed in the repr

Pablo Galindo Salgado report at bugs.python.org
Mon Aug 16 18:05:48 EDT 2021


Pablo Galindo Salgado <pablogsal at gmail.com> added the comment:

Same happens when printing a enum.Flag with some values:

>>> enum.Flag(1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/pablogsal/github/cpython/Lib/enum.py", line 597, in __call__
    return cls.__new__(cls, value)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pablogsal/github/cpython/Lib/enum.py", line 944, in __new__
    raise exc
    ^^^^^^^^^
  File "/home/pablogsal/github/cpython/Lib/enum.py", line 921, in __new__
    result = cls._missing_(value)
             ^^^^^^^^^^^^^^^^^^^^
  File "/home/pablogsal/github/cpython/Lib/enum.py", line 1185, in _missing_
    raise ValueError(
    ^^^^^^^^^^^^^^^^^
ValueError: Flag: invalid value: 1
    given 0b0 1
  allowed 0b0 0

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44929>
_______________________________________


More information about the Python-bugs-list mailing list