[Python-checkins] [3.7] Fix typos in docs, comments and test assert messages (GH-14872). (#14901)

Terry Jan Reedy webhook-mailer at python.org
Mon Jul 22 14:14:29 EDT 2019


https://github.com/python/cpython/commit/83cec020ba177fa27727330ba4ccf60eebc22a54
commit: 83cec020ba177fa27727330ba4ccf60eebc22a54
branch: 3.7
author: Kyle Stanley <aeros167 at gmail.com>
committer: Terry Jan Reedy <tjreedy at udel.edu>
date: 2019-07-22T14:14:07-04:00
summary:

[3.7] Fix typos in docs, comments and test assert messages (GH-14872). (#14901)

(cherry picked from commit 96e12d5f4f3c5a20986566038ee763dff3c228a1)

Co-authored-by: Min ho Kim <minho42 at gmail.com>

files:
M Doc/library/ctypes.rst
M Lib/collections/__init__.py
M Lib/dataclasses.py
M Lib/email/headerregistry.py
M Lib/importlib/_bootstrap_external.py
M Lib/test/support/__init__.py
M Lib/test/test_dataclasses.py
M Lib/test/test_eintr.py
M Lib/test/test_random.py
M Misc/NEWS.d/3.5.2rc1.rst
M Misc/NEWS.d/3.6.0a1.rst
M Misc/NEWS.d/3.6.3rc1.rst
M Modules/_pickle.c

diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst
index 6cd4f9779f6d..2eafa654e2e6 100644
--- a/Doc/library/ctypes.rst
+++ b/Doc/library/ctypes.rst
@@ -1175,7 +1175,7 @@ Keep in mind that retrieving sub-objects from Structure, Unions, and Arrays
 doesn't *copy* the sub-object, instead it retrieves a wrapper object accessing
 the root-object's underlying buffer.
 
-Another example that may behave different from what one would expect is this::
+Another example that may behave differently from what one would expect is this::
 
    >>> s = c_char_p()
    >>> s.value = b"abc def ghi"
diff --git a/Lib/collections/__init__.py b/Lib/collections/__init__.py
index 64bbee8faba8..7ff3c80a06a7 100644
--- a/Lib/collections/__init__.py
+++ b/Lib/collections/__init__.py
@@ -444,7 +444,7 @@ def __getnewargs__(self):
         '__slots__': (),
         '_fields': field_names,
         '_field_defaults': field_defaults,
-        # alternate spelling for backward compatiblity
+        # alternate spelling for backward compatibility
         '_fields_defaults': field_defaults,
         '__new__': __new__,
         '_make': _make,
diff --git a/Lib/dataclasses.py b/Lib/dataclasses.py
index 8c3d638e86bc..7725621e0fae 100644
--- a/Lib/dataclasses.py
+++ b/Lib/dataclasses.py
@@ -1185,7 +1185,7 @@ class C(Base):
             raise TypeError(f'Invalid field: {item!r}')
 
         if not isinstance(name, str) or not name.isidentifier():
-            raise TypeError(f'Field names must be valid identifers: {name!r}')
+            raise TypeError(f'Field names must be valid identifiers: {name!r}')
         if keyword.iskeyword(name):
             raise TypeError(f'Field names must not be keywords: {name!r}')
         if name in seen:
diff --git a/Lib/email/headerregistry.py b/Lib/email/headerregistry.py
index 00652049f2fa..0218cbfbd098 100644
--- a/Lib/email/headerregistry.py
+++ b/Lib/email/headerregistry.py
@@ -245,7 +245,7 @@ def fold(self, *, policy):
         the header name and the ': ' separator.
 
         """
-        # At some point we need to put fws here iif it was in the source.
+        # At some point we need to put fws here if it was in the source.
         header = parser.Header([
             parser.HeaderLabel([
                 parser.ValueTerminal(self.name, 'header-name'),
diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py
index 53b24ff1b0f2..66a16a683962 100644
--- a/Lib/importlib/_bootstrap_external.py
+++ b/Lib/importlib/_bootstrap_external.py
@@ -246,7 +246,7 @@ def _write_atomic(path, data, mode=0o666):
 #     Python 3.7a2  3391 (update GET_AITER #31709)
 #     Python 3.7a4  3392 (PEP 552: Deterministic pycs #31650)
 #     Python 3.7b1  3393 (remove STORE_ANNOTATION opcode #32550)
-#     Python 3.7b5  3394 (restored docstring as the firts stmt in the body;
+#     Python 3.7b5  3394 (restored docstring as the first stmt in the body;
 #                         this might affected the first line number #32911)
 #
 # MAGIC must change whenever the bytecode emitted by the compiler may no
diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py
index 87bfa9f54627..6e40a143c274 100644
--- a/Lib/test/support/__init__.py
+++ b/Lib/test/support/__init__.py
@@ -2806,7 +2806,7 @@ def fd_count():
     if sys.platform.startswith(('linux', 'freebsd')):
         try:
             names = os.listdir("/proc/self/fd")
-            # Substract one because listdir() opens internally a file
+            # Subtract one because listdir() internally opens a file
             # descriptor to list the content of the /proc/self/fd/ directory.
             return len(names) - 1
         except FileNotFoundError:
diff --git a/Lib/test/test_dataclasses.py b/Lib/test/test_dataclasses.py
index a2c7ceea9da2..f36098c69339 100755
--- a/Lib/test/test_dataclasses.py
+++ b/Lib/test/test_dataclasses.py
@@ -3037,11 +3037,11 @@ def test_keyword_field_names(self):
     def test_non_identifier_field_names(self):
         for field in ['()', 'x,y', '*', '2 at 3', '', 'little johnny tables']:
             with self.subTest(field=field):
-                with self.assertRaisesRegex(TypeError, 'must be valid identifers'):
+                with self.assertRaisesRegex(TypeError, 'must be valid identifiers'):
                     make_dataclass('C', ['a', field])
-                with self.assertRaisesRegex(TypeError, 'must be valid identifers'):
+                with self.assertRaisesRegex(TypeError, 'must be valid identifiers'):
                     make_dataclass('C', [field])
-                with self.assertRaisesRegex(TypeError, 'must be valid identifers'):
+                with self.assertRaisesRegex(TypeError, 'must be valid identifiers'):
                     make_dataclass('C', [field, 'a'])
 
     def test_underscore_field_names(self):
diff --git a/Lib/test/test_eintr.py b/Lib/test/test_eintr.py
index f61efa3c648e..a5f8f6465e88 100644
--- a/Lib/test/test_eintr.py
+++ b/Lib/test/test_eintr.py
@@ -22,7 +22,7 @@ def test_all(self):
             print()
             print("--- run eintr_tester.py ---", flush=True)
             # In verbose mode, the child process inherit stdout and stdout,
-            # to see output in realtime and reduce the risk of loosing output.
+            # to see output in realtime and reduce the risk of losing output.
             args = [sys.executable, "-E", "-X", "faulthandler", *args]
             proc = subprocess.run(args)
             print(f"--- eintr_tester.py completed: "
diff --git a/Lib/test/test_random.py b/Lib/test/test_random.py
index f0822cddec86..6b9e90594cb2 100644
--- a/Lib/test/test_random.py
+++ b/Lib/test/test_random.py
@@ -228,7 +228,7 @@ def test_choices(self):
             choices([], cum_weights=[], k=5)
 
     def test_choices_subnormal(self):
-        # Subnormal weights would occassionally trigger an IndexError
+        # Subnormal weights would occasionally trigger an IndexError
         # in choices() when the value returned by random() was large
         # enough to make `random() * total` round up to the total.
         # See https://bugs.python.org/msg275594 for more detail.
diff --git a/Misc/NEWS.d/3.5.2rc1.rst b/Misc/NEWS.d/3.5.2rc1.rst
index 231c3cac9c5f..40b9e803da29 100644
--- a/Misc/NEWS.d/3.5.2rc1.rst
+++ b/Misc/NEWS.d/3.5.2rc1.rst
@@ -2006,7 +2006,7 @@ Adds validation of ucrtbase[d].dll version with warning for old versions.
 .. nonce: 102DA-
 .. section: Build
 
-Avoid error about nonexistant fileblocks.o file by using a lower-level check
+Avoid error about nonexistent fileblocks.o file by using a lower-level check
 for st_blocks in struct stat.
 
 ..
diff --git a/Misc/NEWS.d/3.6.0a1.rst b/Misc/NEWS.d/3.6.0a1.rst
index 254d36166450..2df4c613a8e8 100644
--- a/Misc/NEWS.d/3.6.0a1.rst
+++ b/Misc/NEWS.d/3.6.0a1.rst
@@ -3695,7 +3695,7 @@ Adds validation of ucrtbase[d].dll version with warning for old versions.
 .. nonce: 102DA-
 .. section: Build
 
-Avoid error about nonexistant fileblocks.o file by using a lower-level check
+Avoid error about nonexistent fileblocks.o file by using a lower-level check
 for st_blocks in struct stat.
 
 ..
diff --git a/Misc/NEWS.d/3.6.3rc1.rst b/Misc/NEWS.d/3.6.3rc1.rst
index ca812c63eed9..29cff7eae77f 100644
--- a/Misc/NEWS.d/3.6.3rc1.rst
+++ b/Misc/NEWS.d/3.6.3rc1.rst
@@ -885,8 +885,7 @@ The affected events are '<<force-open-completions>>', '<<expand-word>>',
 '<<run-module>>', '<<check-module>>', and '<<zoom-height>>'.  Any (global)
 customizations made before 3.6.3 will not affect their keyset-specific
 customization after 3.6.3. and vice versa.
-
-Inital patch by Charles Wohlganger.
+Initial patch by Charles Wohlganger.
 
 ..
 
diff --git a/Modules/_pickle.c b/Modules/_pickle.c
index 9a6207b519fa..dd45772595bc 100644
--- a/Modules/_pickle.c
+++ b/Modules/_pickle.c
@@ -1999,7 +1999,7 @@ save_long(PicklerObject *self, PyObject *obj)
         /* How many bytes do we need?  There are nbits >> 3 full
          * bytes of data, and nbits & 7 leftover bits.  If there
          * are any leftover bits, then we clearly need another
-         * byte.  Wnat's not so obvious is that we *probably*
+         * byte.  What's not so obvious is that we *probably*
          * need another byte even if there aren't any leftovers:
          * the most-significant bit of the most-significant byte
          * acts like a sign bit, and it's usually got a sense



More information about the Python-checkins mailing list