-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
Some RegexFlag cannot be printed in the repr #89092
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
When printing some instance of RegexFlag **in the REPL** it fails to print: >>> import gc
# This prints a ton of objects, including the bad enum RegexFlag one
>>> gc.get_referrers(None)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/pablogsal/github/cpython/Lib/enum.py", line 1399, in global_flag_repr
return "%x" % (module, cls_name, self._value_)
~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TypeError: %x format: an integer is required, not str |
(Deleted last message because it was incorrect) |
Simpler reproducer: >>> import re
>>> re.RegexFlag(0)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/pablogsal/github/cpython/Lib/enum.py", line 1399, in global_flag_repr
return "%x" % (module, cls_name, self._value_)
~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TypeError: %x format: an integer is required, not str |
This looks incorrect: Line 1399 in 1512bc2
|
Ethan, could you take a look at the PR? I added a few failing test methods since |
class Example(Flag, boundary=KEEP):
first = auto()
second = auto()
third = auto() >>> Example(0)
module.Example(0)
>>> Example(8)
module.Example(8) No need to backport. |
repr(re.RegexFlag(0)) no longer crashes so we can close this. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: