Issue38294
Created on 2019-09-27 17:06 by rbanffy, last changed 2022-04-11 14:59 by admin. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 16442 | merged | python-dev, 2019-09-27 21:11 | |
| PR 16626 | merged | miss-islington, 2019-10-07 21:00 | |
| PR 16647 | merged | rbanffy, 2019-10-08 10:29 | |
| Messages (10) | |||
|---|---|---|---|
| msg353380 - (view) | Author: Ricardo Bánffy (rbanffy) * | Date: 2019-09-27 17:06 | |
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.
|
|||
| msg353384 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * | Date: 2019-09-27 17:27 | |
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. |
|||
| msg353389 - (view) | Author: Ricardo Bánffy (rbanffy) * | Date: 2019-09-27 18:53 | |
Thanks for the clarification, Serhiy. Should we update the 3.7 docs to warn others about it? |
|||
| msg353390 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * | Date: 2019-09-27 19:26 | |
It is already documented. There are even examples which contain "/" and ":". |
|||
| msg353392 - (view) | Author: Ricardo Bánffy (rbanffy) * | Date: 2019-09-27 19:39 | |
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. |
|||
| msg354141 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * | Date: 2019-10-07 20:54 | |
New changeset 15ae75d660befe643ed42eb2707a557cea97256c by Serhiy Storchaka (Ricardo Bánffy) in branch 'master': bpo-38294: Add list of no-longer-escaped chars to re.escape documentation. (GH-16442) https://github.com/python/cpython/commit/15ae75d660befe643ed42eb2707a557cea97256c |
|||
| msg354143 - (view) | Author: miss-islington (miss-islington) | Date: 2019-10-07 21:07 | |
New changeset b731fc521cf78e53268e35777d836ca80e7ab305 by Miss Islington (bot) in branch '3.8': bpo-38294: Add list of no-longer-escaped chars to re.escape documentation. (GH-16442) https://github.com/python/cpython/commit/b731fc521cf78e53268e35777d836ca80e7ab305 |
|||
| msg354221 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * | Date: 2019-10-08 16:41 | |
New changeset 43f5c0c4d0a608c04c3978adb45117f3943203b7 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) https://github.com/python/cpython/commit/43f5c0c4d0a608c04c3978adb45117f3943203b7 |
|||
| msg354258 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * | Date: 2019-10-09 09:07 | |
Thank you for your contribution Ricardo! |
|||
| msg354698 - (view) | Author: Ned Deily (ned.deily) * | Date: 2019-10-15 07:30 | |
New changeset ae41f629e187e1f0cf4d62f5a7b181c64da26466 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) https://github.com/python/cpython/commit/ae41f629e187e1f0cf4d62f5a7b181c64da26466 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:59:20 | admin | set | github: 82475 |
| 2019-10-15 07:30:25 | ned.deily | set | nosy:
+ ned.deily messages: + msg354698 |
| 2019-10-09 09:07:52 | serhiy.storchaka | set | status: open -> closed resolution: fixed messages: + msg354258 stage: patch review -> resolved |
| 2019-10-08 16:41:04 | serhiy.storchaka | set | messages: + msg354221 |
| 2019-10-08 10:29:06 | rbanffy | set | pull_requests: + pull_request16230 |
| 2019-10-07 21:07:49 | miss-islington | set | nosy:
+ miss-islington messages: + msg354143 |
| 2019-10-07 21:00:58 | miss-islington | set | pull_requests: + pull_request16212 |
| 2019-10-07 20:54:41 | serhiy.storchaka | set | messages: + msg354141 |
| 2019-10-01 07:59:20 | rbanffy | set | title: re.escape no longer escapes "/" or ":" -> Documentation on 3.6->3.7 re.escape no longer escaping "/" or ":" should be obvious |
| 2019-09-30 06:53:26 | rbanffy | set | components:
+ Regular Expressions versions: + Python 3.9 |
| 2019-09-27 21:11:28 | python-dev | set | keywords:
+ patch stage: patch review pull_requests: + pull_request16021 |
| 2019-09-27 20:00:14 | rbanffy | set | assignee: docs@python type: behavior -> enhancement |
| 2019-09-27 19:39:52 | rbanffy | set | messages: + msg353392 |
| 2019-09-27 19:26:14 | serhiy.storchaka | set | messages: + msg353390 |
| 2019-09-27 18:53:57 | rbanffy | set | messages: + msg353389 |
| 2019-09-27 17:27:26 | serhiy.storchaka | set | nosy:
+ serhiy.storchaka messages: + msg353384 |
| 2019-09-27 17:08:47 | rbanffy | set | title: re.escape seems to miss some importante regex characters -> re.escape no longer escapes "/" or ":" |
| 2019-09-27 17:06:37 | rbanffy | create | |