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

Weak deprecations for inline regular expression modifiers #74484

Closed
serhiy-storchaka opened this issue May 7, 2017 · 5 comments
Closed

Weak deprecations for inline regular expression modifiers #74484

serhiy-storchaka opened this issue May 7, 2017 · 5 comments
Labels
3.7 (EOL) end of life stdlib Python modules in the Lib dir topic-regex type-bug An unexpected behavior, bug, or error

Comments

@serhiy-storchaka
Copy link
Member

BPO 30298
Nosy @rhettinger, @ezio-melotti, @serhiy-storchaka
PRs
  • bpo-30298: Weaken the condition of deprecation warnings for inline modifiers. #1490
  • [3.6] bpo-30298: Weaken the condition of deprecation warnings for inline modifiers. (GH-1490) #1525
  • 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 2017-05-10.03:44:51.484>
    created_at = <Date 2017-05-07.14:39:18.298>
    labels = ['expert-regex', 'type-bug', 'library', '3.7']
    title = 'Weak deprecations for inline regular expression modifiers'
    updated_at = <Date 2017-05-10.03:44:51.483>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2017-05-10.03:44:51.483>
    actor = 'serhiy.storchaka'
    assignee = 'none'
    closed = True
    closed_date = <Date 2017-05-10.03:44:51.484>
    closer = 'serhiy.storchaka'
    components = ['Library (Lib)', 'Regular Expressions']
    creation = <Date 2017-05-07.14:39:18.298>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 30298
    keywords = []
    message_count = 5.0
    messages = ['293197', '293203', '293372', '293374', '293375']
    nosy_count = 4.0
    nosy_names = ['rhettinger', 'ezio.melotti', 'mrabarnett', 'serhiy.storchaka']
    pr_nums = ['1490', '1525']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue30298'
    versions = ['Python 3.6', 'Python 3.7']

    @serhiy-storchaka
    Copy link
    Member Author

    There is a difference between handling inline modifiers in regular expressions between Python and all other regular expression engines that support inline modifiers. In other engines an inline modifier affect only the part of the pattern after it. It Python it affects also the part before it. For avoiding possible confusion and for removing this difference in distant future, using inline modifiers not at the start of the pattern was deprecated in 3.6 (see bpo-22493).

    But the condition for raising a warning is too strong. It allows using '(?is)...', but '(?i)(?s)...' emits a warning. This makes hard modifying regular expressions by prefixing them with inline modifiers. This condition is unjustifiably strong because '(?i)(?s)...' doesn't have any ambiguity. It also disallows ' (?i)...' in verbose mode despite the fact that whitespaces are not significant in verbose mode.

    Proposed patch weaks the condition of deprecation warnings. It allows using several subsequent inline modifiers at the start of the pattern and ignores whitespaces in verbose mode.

    @serhiy-storchaka serhiy-storchaka added 3.7 (EOL) end of life stdlib Python modules in the Lib dir topic-regex type-bug An unexpected behavior, bug, or error labels May 7, 2017
    @rhettinger
    Copy link
    Contributor

    LGTM

    @serhiy-storchaka
    Copy link
    Member Author

    New changeset 305ccbe by Serhiy Storchaka in branch 'master':
    bpo-30298: Weaken the condition of deprecation warnings for inline modifiers. (bpo-1490)
    305ccbe

    @serhiy-storchaka
    Copy link
    Member Author

    New changeset 418d60a by Serhiy Storchaka in branch '3.6':
    [3.6] bpo-30298: Weaken the condition of deprecation warnings for inline modifiers. (GH-1490) (bpo-1525)
    418d60a

    @serhiy-storchaka
    Copy link
    Member Author

    Thanks Raymond.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life stdlib Python modules in the Lib dir topic-regex type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants