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

Documentation on 3.6->3.7 re.escape no longer escaping "/" or ":" should be obvious #82475

Closed
rbanffy mannequin opened this issue Sep 27, 2019 · 10 comments
Closed

Documentation on 3.6->3.7 re.escape no longer escaping "/" or ":" should be obvious #82475

rbanffy mannequin opened this issue Sep 27, 2019 · 10 comments
Labels
3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes docs Documentation in the Doc dir topic-regex type-feature A feature request or enhancement

Comments

@rbanffy
Copy link
Mannequin

rbanffy mannequin commented Sep 27, 2019

BPO 38294
Nosy @ned-deily, @ezio-melotti, @serhiy-storchaka, @rbanffy, @miss-islington
PRs
  • bpo-38294: Add list of no-longer-escaped chars to re.escape documentation #16442
  • [3.8] bpo-38294: Add list of no-longer-escaped chars to re.escape documentation. (GH-16442) #16626
  • [3.7] bpo-38294: Add list of no-longer-escaped chars to re.escape doc… #16647
  • 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 2019-10-09.09:07:52.018>
    created_at = <Date 2019-09-27.17:06:37.558>
    labels = ['expert-regex', '3.7', '3.8', '3.9', 'type-feature', 'docs']
    title = 'Documentation on 3.6->3.7 re.escape no longer escaping "/" or ":" should be obvious'
    updated_at = <Date 2019-10-15.07:30:25.763>
    user = 'https://github.com/rbanffy'

    bugs.python.org fields:

    activity = <Date 2019-10-15.07:30:25.763>
    actor = 'ned.deily'
    assignee = 'docs@python'
    closed = True
    closed_date = <Date 2019-10-09.09:07:52.018>
    closer = 'serhiy.storchaka'
    components = ['Documentation', 'Regular Expressions']
    creation = <Date 2019-09-27.17:06:37.558>
    creator = 'rbanffy'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 38294
    keywords = ['patch']
    message_count = 10.0
    messages = ['353380', '353384', '353389', '353390', '353392', '354141', '354143', '354221', '354258', '354698']
    nosy_count = 7.0
    nosy_names = ['ned.deily', 'ezio.melotti', 'mrabarnett', 'docs@python', 'serhiy.storchaka', 'rbanffy', 'miss-islington']
    pr_nums = ['16442', '16626', '16647']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue38294'
    versions = ['Python 3.7', 'Python 3.8', 'Python 3.9']

    @rbanffy
    Copy link
    Mannequin Author

    rbanffy mannequin commented Sep 27, 2019

    Under Python 3.6, re.escape escapes "/"

    In [1]: import re

    In [2]: re.escape('http://workday.com')
    Out[2]: 'http\\:\\/\\/workday\\.com'

    Under 3.7 and 3.8, "/" is not escaped.

    In [1]: import re

    In [2]: re.escape('http://workday.com')
    Out[2]: 'http://workday\\\\.com'

    Is this change deliberate? For a minor release (3.6 to 3.7) this broke some code that generated sed commands to run on a remote server.

    @rbanffy rbanffy mannequin added type-bug An unexpected behavior, bug, or error topic-regex 3.7 (EOL) end of life 3.8 only security fixes labels Sep 27, 2019
    @rbanffy rbanffy mannequin changed the title re.escape seems to miss some importante regex characters re.escape no longer escapes "/" or ":" Sep 27, 2019
    @serhiy-storchaka
    Copy link
    Member

    Yes, it is deliberate. "/" and ":" do not have special meaning in regular expressions and do not need escaping. re.escape() now produces more human-readable result and works faster.

    @rbanffy
    Copy link
    Mannequin Author

    rbanffy mannequin commented Sep 27, 2019

    Thanks for the clarification, Serhiy. Should we update the 3.7 docs to warn others about it?

    @serhiy-storchaka
    Copy link
    Member

    It is already documented. There are even examples which contain "/" and ":".

    @rbanffy
    Copy link
    Mannequin Author

    rbanffy mannequin commented Sep 27, 2019

    Indeed. It was easy to miss because of the joining and sorting. Being explicit on the 3.7 changes, that '!', '"', '%', "'", ',', '/', ':', ';', '<', '=', '>', '@', '`' were up to 3.6 but are no longer escaped since 3.7, would be nice.

    @rbanffy rbanffy mannequin added docs Documentation in the Doc dir and removed topic-regex labels Sep 27, 2019
    @rbanffy rbanffy mannequin assigned docspython Sep 27, 2019
    @rbanffy rbanffy mannequin added type-feature A feature request or enhancement topic-regex 3.9 only security fixes and removed type-bug An unexpected behavior, bug, or error labels Sep 27, 2019
    @rbanffy rbanffy mannequin changed the title re.escape no longer escapes "/" or ":" Documentation on 3.6->3.7 re.escape no longer escaping "/" or ":" should be obvious Oct 1, 2019
    @serhiy-storchaka
    Copy link
    Member

    New changeset 15ae75d by Serhiy Storchaka (Ricardo Bánffy) in branch 'master':
    bpo-38294: Add list of no-longer-escaped chars to re.escape documentation. (GH-16442)
    15ae75d

    @miss-islington
    Copy link
    Contributor

    New changeset b731fc5 by Miss Islington (bot) in branch '3.8':
    bpo-38294: Add list of no-longer-escaped chars to re.escape documentation. (GH-16442)
    b731fc5

    @serhiy-storchaka
    Copy link
    Member

    New changeset 43f5c0c by Serhiy Storchaka (Ricardo Bánffy) in branch '3.7':
    [3.7] bpo-38294: Add list of no-longer-escaped chars to re.escape documentation. (GH-16442) (GH-16647)
    43f5c0c

    @serhiy-storchaka
    Copy link
    Member

    Thank you for your contribution Ricardo!

    @ned-deily
    Copy link
    Member

    New changeset ae41f62 by Ned Deily (Ricardo Bánffy) in branch '3.7':
    [3.7] bpo-38294: Add list of no-longer-escaped chars to re.escape documentation. (GH-16442) (GH-16647)
    ae41f62

    @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 3.8 only security fixes 3.9 only security fixes docs Documentation in the Doc dir topic-regex type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants