[Python-checkins] cpython (2.7): #15980: properly escape newlines in docstrings. Patch by Serhiy Storchaka.

ezio.melotti python-checkins at python.org
Fri Sep 21 15:31:47 CEST 2012


http://hg.python.org/cpython/rev/7a125913a375
changeset: 79083:7a125913a375
branch: 2.7
parent: 79080:53fa224b95f4
user: Ezio Melotti <ezio.melotti at gmail.com>
date: Fri Sep 21 16:27:45 2012 +0300
summary:
 #15980: properly escape newlines in docstrings. Patch by Serhiy Storchaka.
files:
 Lib/_LWPCookieJar.py | 4 ++--
 Lib/email/base64mime.py | 2 +-
 Lib/email/utils.py | 4 ++--
 Lib/rfc822.py | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/Lib/_LWPCookieJar.py b/Lib/_LWPCookieJar.py
--- a/Lib/_LWPCookieJar.py
+++ b/Lib/_LWPCookieJar.py
@@ -48,7 +48,7 @@
 
 class LWPCookieJar(FileCookieJar):
 """
- The LWPCookieJar saves a sequence of"Set-Cookie3" lines.
+ The LWPCookieJar saves a sequence of "Set-Cookie3" lines.
 "Set-Cookie3" is the format used by the libwww-perl libary, not known
 to be compatible with any browser, but which is easy to read and
 doesn't lose information about RFC 2965 cookies.
@@ -60,7 +60,7 @@
 """
 
 def as_lwp_str(self, ignore_discard=True, ignore_expires=True):
- """Return cookies as a string of "\n"-separated "Set-Cookie3" headers.
+ """Return cookies as a string of "\\n"-separated "Set-Cookie3" headers.
 
 ignore_discard and ignore_expires: see docstring for FileCookieJar.save
 
diff --git a/Lib/email/base64mime.py b/Lib/email/base64mime.py
--- a/Lib/email/base64mime.py
+++ b/Lib/email/base64mime.py
@@ -130,7 +130,7 @@
 verbatim (this is the default).
 
 Each line of encoded text will end with eol, which defaults to "\\n". Set
- this to "\r\n" if you will be using the result of this function directly
+ this to "\\r\\n" if you will be using the result of this function directly
 in an email.
 """
 if not s:
diff --git a/Lib/email/utils.py b/Lib/email/utils.py
--- a/Lib/email/utils.py
+++ b/Lib/email/utils.py
@@ -63,7 +63,7 @@
 """Decodes a base64 string.
 
 This function is equivalent to base64.decodestring and it's retained only
- for backward compatibility. It used to remove the last \n of the decoded
+ for backward compatibility. It used to remove the last \\n of the decoded
 string, if it had any (see issue 7143).
 """
 if not s:
@@ -73,7 +73,7 @@
 
 
 def fix_eols(s):
- """Replace all line-ending characters with \r\n."""
+ """Replace all line-ending characters with \\r\\n."""
 # Fix newlines with no preceding carriage return
 s = re.sub(r'(?<!\r)\n', CRLF, s)
 # Fix carriage returns with no following newline
diff --git a/Lib/rfc822.py b/Lib/rfc822.py
--- a/Lib/rfc822.py
+++ b/Lib/rfc822.py
@@ -212,7 +212,7 @@
 You may override this method if your application wants to bend the
 rules, e.g. to strip trailing whitespace, or to recognize MH template
 separators ('--------'). For convenience (e.g. for code reading from
- sockets) a line consisting of \r\n also matches.
+ sockets) a line consisting of \\r\\n also matches.
 """
 return line in _blanklines
 
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /