[Python-checkins] cpython (3.4): Escaped backslashes in docstrings.

serhiy.storchaka python-checkins at python.org
Fri Apr 3 17:13:46 CEST 2015


https://hg.python.org/cpython/rev/e855bde79795
changeset:   95417:e855bde79795
branch:      3.4
parent:      95414:c167b9f9aac8
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Fri Apr 03 18:12:41 2015 +0300
summary:
  Escaped backslashes in docstrings.

files:
  Lib/base64.py                |  4 ++--
  Lib/codecs.py                |  2 +-
  Lib/email/_encoded_words.py  |  2 +-
  Lib/idlelib/SearchEngine.py  |  2 +-
  Lib/smtplib.py               |  4 ++--
  Lib/test/support/__init__.py |  6 +++---
  Lib/textwrap.py              |  6 +++---
  7 files changed, 13 insertions(+), 13 deletions(-)


diff --git a/Lib/base64.py b/Lib/base64.py
--- a/Lib/base64.py
+++ b/Lib/base64.py
@@ -324,7 +324,7 @@
     instead of 4 consecutive spaces (ASCII 0x20) as supported by 'btoa'. This
     feature is not supported by the "standard" Adobe encoding.
 
-    wrapcol controls whether the output should have newline ('\n') characters
+    wrapcol controls whether the output should have newline ('\\n') characters
     added to it. If this is non-zero, each output line will be at most this
     many characters long.
 
@@ -434,7 +434,7 @@
 def b85encode(b, pad=False):
     """Encode an ASCII-encoded byte array in base85 format.
 
-    If pad is true, the input is padded with "\0" so its length is a multiple of
+    If pad is true, the input is padded with "\\0" so its length is a multiple of
     4 characters before encoding.
     """
     global _b85chars, _b85chars2
diff --git a/Lib/codecs.py b/Lib/codecs.py
--- a/Lib/codecs.py
+++ b/Lib/codecs.py
@@ -1061,7 +1061,7 @@
         during translation.
 
         One example where this happens is cp875.py which decodes
-        multiple character to \u001a.
+        multiple character to \\u001a.
 
     """
     m = {}
diff --git a/Lib/email/_encoded_words.py b/Lib/email/_encoded_words.py
--- a/Lib/email/_encoded_words.py
+++ b/Lib/email/_encoded_words.py
@@ -152,7 +152,7 @@
     then from the resulting bytes into unicode using the specified charset.  If
     the cte-decoded string does not successfully decode using the specified
     character set, a defect is added to the defects list and the unknown octets
-    are replaced by the unicode 'unknown' character \uFDFF.
+    are replaced by the unicode 'unknown' character \\uFDFF.
 
     The specified charset and language are returned.  The default for language,
     which is rarely if ever encountered, is the empty string.
diff --git a/Lib/idlelib/SearchEngine.py b/Lib/idlelib/SearchEngine.py
--- a/Lib/idlelib/SearchEngine.py
+++ b/Lib/idlelib/SearchEngine.py
@@ -191,7 +191,7 @@
 
     This is done by searching forwards until there is no match.
     Prog: compiled re object with a search method returning a match.
-    Chars: line of text, without \n.
+    Chars: line of text, without \\n.
     Col: stop index for the search; the limit for match.end().
     '''
     m = prog.search(chars)
diff --git a/Lib/smtplib.py b/Lib/smtplib.py
--- a/Lib/smtplib.py
+++ b/Lib/smtplib.py
@@ -518,8 +518,8 @@
         Raises SMTPDataError if there is an unexpected reply to the
         DATA command; the return value from this method is the final
         response code received when the all data is sent.  If msg
-        is a string, lone '\r' and '\n' characters are converted to
-        '\r\n' characters.  If msg is bytes, it is transmitted as is.
+        is a string, lone '\\r' and '\\n' characters are converted to
+        '\\r\\n' characters.  If msg is bytes, it is transmitted as is.
         """
         self.putcmd("data")
         (code, repl) = self.getreply()
diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py
--- a/Lib/test/support/__init__.py
+++ b/Lib/test/support/__init__.py
@@ -1379,7 +1379,7 @@
 
        with captured_stdout() as stdout:
            print("hello")
-       self.assertEqual(stdout.getvalue(), "hello\n")
+       self.assertEqual(stdout.getvalue(), "hello\\n")
     """
     return captured_output("stdout")
 
@@ -1388,7 +1388,7 @@
 
        with captured_stderr() as stderr:
            print("hello", file=sys.stderr)
-       self.assertEqual(stderr.getvalue(), "hello\n")
+       self.assertEqual(stderr.getvalue(), "hello\\n")
     """
     return captured_output("stderr")
 
@@ -1396,7 +1396,7 @@
     """Capture the input to sys.stdin:
 
        with captured_stdin() as stdin:
-           stdin.write('hello\n')
+           stdin.write('hello\\n')
            stdin.seek(0)
            # call test code that consumes from sys.stdin
            captured = input()
diff --git a/Lib/textwrap.py b/Lib/textwrap.py
--- a/Lib/textwrap.py
+++ b/Lib/textwrap.py
@@ -133,7 +133,7 @@
         """_munge_whitespace(text : string) -> string
 
         Munge whitespace in text: expand tabs and convert all other
-        whitespace characters to spaces.  Eg. " foo\tbar\n\nbaz"
+        whitespace characters to spaces.  Eg. " foo\\tbar\\n\\nbaz"
         becomes " foo    bar  baz".
         """
         if self.expand_tabs:
@@ -169,7 +169,7 @@
         """_fix_sentence_endings(chunks : [string])
 
         Correct for sentence endings buried in 'chunks'.  Eg. when the
-        original text contains "... foo.\nBar ...", munge_whitespace()
+        original text contains "... foo.\\nBar ...", munge_whitespace()
         and split() will convert that to [..., "foo.", " ", "Bar", ...]
         which has one too few spaces; this method simply changes the one
         space to two.
@@ -405,7 +405,7 @@
     in indented form.
 
     Note that tabs and spaces are both treated as whitespace, but they
-    are not equal: the lines "  hello" and "\thello" are
+    are not equal: the lines "  hello" and "\\thello" are
     considered to have no common leading whitespace.  (This behaviour is
     new in Python 2.5; older versions of this module incorrectly
     expanded tabs before searching for common leading whitespace.)

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list