Skip to content
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

Convert a warning about flags not at the start of the regular expression into error #91222

Closed
serhiy-storchaka opened this issue Mar 19, 2022 · 2 comments
Labels
3.11 expert-regex stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@serhiy-storchaka
Copy link
Member

serhiy-storchaka commented Mar 19, 2022

BPO 47066
Nosy @ezio-melotti, @serhiy-storchaka
PRs
  • bpo-47066: Convert a warning about flags not at the start of the regu… #31994
  • 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:

    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'

    bugs.python.org fields:

    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']

    @serhiy-storchaka
    Copy link
    Member Author

    serhiy-storchaka commented Mar 19, 2022

    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.

    @serhiy-storchaka serhiy-storchaka added 3.11 stdlib Python modules in the Lib dir expert-regex type-bug An unexpected behavior, bug, or error labels Mar 19, 2022
    @serhiy-storchaka
    Copy link
    Member Author

    serhiy-storchaka commented Mar 19, 2022

    New changeset 92a6abf by Serhiy Storchaka in branch 'main':
    bpo-47066: Convert a warning about flags not at the start of the regular expression into error (GH-31994)
    92a6abf

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.11 expert-regex stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant