This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: (email) Escape backslashes in specialsre and escapesre
Type: Stage:
Components: Library (Lib) Versions:
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: barry Nosy List: barry, mattheww
Priority: normal Keywords: patch

Created on 2003-01-06 22:37 by mattheww, last changed 2022-04-10 16:06 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
patch mattheww, 2003-01-06 22:55 Patch to lib and testcase
Messages (4)
msg42346 - (view) Author: Matthew Woodcraft (mattheww) Date: 2003-01-06 22:37
(email/Utils.py) Escape backslashes in character
classes in specialsre and escapesre.

Patch against sourceforge CVS as of 2003-01-06
python/dist/src/Lib/email/Utils.py  rev 1.21
python/dist/src/Lib/email/test/test_email.py  rev 1.29
msg42347 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2003-03-10 17:52
Logged In: YES 
user_id=12800

This patch doesn't look right.  First, we're using raw
strings so we don't need to escape backslashes.  Second, why
did you add backslashes around the word Silly in the test case?
msg42348 - (view) Author: Matthew Woodcraft (mattheww) Date: 2003-03-10 18:49
Logged In: YES 
user_id=57248

The backslashes need to be escaped, not for the Python string
interpreter, but for the regular expression compiler --
backslashes in
character classes need to be doubled in order to stand for
themselves.
Currently, the backslashes in the character classes are
'escaping' the
following open parenthesis characters, and effectively being
ignored.

The change to the testcase is there in order to test for the
bug being
fixed: backslashes in quoted-strings must be escaped (rfc822
3.3 /
rfc2822 3.2.5).
msg42349 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2003-03-10 19:30
Logged In: YES 
user_id=12800

Gotcha, thanks.  The unittest patch isn't right but I'll
commit a correct one.
History
Date User Action Args
2022-04-10 16:06:06adminsetgithub: 37729
2003-01-06 22:37:41matthewwcreate