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
Tools/demo/redemo.py broken #74907
Comments
In Python 3.6, the flags in the "re" module became members of an enum.IntFlag, whereas before they were just ints. This breaks the regex demo in Tools/demo/redemo.py. To fix this, in line 86 of redemo.py, getattr(re, name) has to be replaced by
Also, the checkbox for "LOCALE" can be removed (or fixed), as re.LOCALE is invalid for str patterns. |
Hi Christoph, chould you provide a small example that breaks the regex demo? thanks! |
Also, would you like to contribute with PR on GitHub? |
Hi, sorry for forgetting steps to reproduce the bug. Easiest way to see it is to start redemo.py from a console (important on windows), so you can see stdout/stderr. And to demonstrate that the flag checkbox does not work, enter ".*" (without quotes) as the pattern, and any multiline string as the string to search, and activate the checkbox "MULTILINE". When it comes to a pull request, I could do that for the change that I proposed. But regarding the "LOCALE" flag, the better solution (in my opinion) would be to make it work instead of just removing it, but that is a more elaborate change that I am not able to spend time on. What would you suggest? |
I think ideally it would be nice to provide a switch between Unicode and bytes and disable the LOCALE flag in the Unicode mode. But this is too complex task. I think it is better to remove LOCALE. |
By the way, I confused the flags, in my error-reproduction steps, instead of the re.MULTILINE flag, it is the re.DOTALL flag that should lead to all lines being matched by ".*". |
Thank you, Christoph. I wasn't aware of Tools/demo/redemo.py and I must say it was fun to play with while reviewing PR 2311. |
The news message is verbose but looks misleading to me. There is nothing invalid with usages like getattr(re, 'DOTALL'). It is the same as re.DOTALL, and using enums haven't changed 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: