Convert a warning about flags not at the start of the regular expression into error #91222
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
assignee = None closed_at = <Date 2022-03-19.14:12:52.270> created_at = <Date 2022-03-19.12:09:48.176> labels = ['expert-regex', 'type-bug', 'library', '3.11'] title = 'Convert a warning about flags not at the start of the regular expression into error' updated_at = <Date 2022-03-19.14:12:52.269> user = 'https://github.com/serhiy-storchaka'
activity = <Date 2022-03-19.14:12:52.269> actor = 'serhiy.storchaka' assignee = 'none' closed = True closed_date = <Date 2022-03-19.14:12:52.270> closer = 'serhiy.storchaka' components = ['Library (Lib)', 'Regular Expressions'] creation = <Date 2022-03-19.12:09:48.176> creator = 'serhiy.storchaka' dependencies =  files =  hgrepos =  issue_num = 47066 keywords = ['patch'] message_count = 2.0 messages = ['415544', '415552'] nosy_count = 3.0 nosy_names = ['ezio.melotti', 'mrabarnett', 'serhiy.storchaka'] pr_nums = ['31994'] priority = 'normal' resolution = 'fixed' stage = 'resolved' status = 'closed' superseder = None type = 'behavior' url = 'https://bugs.python.org/issue47066' versions = ['Python 3.11']
The text was updated successfully, but these errors were encountered:
This warning was introduced in 3.6. The reason is that in most other regular expression implementations global inline flags in the middle of the expression have different semantic: they affect only the part of the expression after the flag. But in Python they affect the whole expression. It caused confusion and was a source of bugs.
After 5 releases it is a time to convert this warning into error. In future we can allow global inline flags in the middle of the expression with different semantic. It is safer if one or more intermediate versions will raise an error.
Misplaced inline flags are no longer allowed in Python 3.11: python/cpython#91222