[3.8] Fix typos in docs, comments and test assert messages (GH-14872). (#14900)
authorKyle Stanley <aeros167@gmail.com>
Mon, 22 Jul 2019 02:48:45 +0000 (22:48 -0400)
committerTerry Jan Reedy <tjreedy@udel.edu>
Mon, 22 Jul 2019 02:48:45 +0000 (22:48 -0400)
(cherry picked from commit 96e12d5f4f3c5a20986566038ee763dff3c228a1)

Co-authored-by: Min ho Kim <minho42@gmail.com>
20 files changed:
Doc/library/ctypes.rst
Lib/asyncio/unix_events.py
Lib/collections/__init__.py
Lib/dataclasses.py
Lib/email/headerregistry.py
Lib/importlib/_bootstrap_external.py
Lib/test/support/__init__.py
Lib/test/test_dataclasses.py
Lib/test/test_eintr.py
Lib/test/test_fstring.py
Lib/test/test_importlib/test_main.py
Lib/test/test_math.py
Lib/test/test_random.py
Misc/NEWS.d/3.5.2rc1.rst
Misc/NEWS.d/3.6.0a1.rst
Misc/NEWS.d/3.6.3rc1.rst
Misc/NEWS.d/3.8.0a1.rst
Modules/_pickle.c
Modules/_xxtestfuzz/fuzzer.c
Python/initconfig.c

index 02a5500e8115fc8c09d8482918dd5dcc74c4d2e6..eb0bcf4ae2e36829cb205e0485f092b5b4e685fd 100644 (file)
@@ -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"
index d7a4af86f71b89bfd7ba9de170fc717f84246a39..cbbb1065aedad7da92f8d0f04c173a6948f92643 100644 (file)
@@ -1243,7 +1243,7 @@ class ThreadedChildWatcher(AbstractChildWatcher):
     It doesn't require subscription on POSIX signal
     but a thread creation is not free.
 
-    The watcher has O(1) complexity, its perfomance doesn't depend
+    The watcher has O(1) complexity, its performance doesn't depend
     on amount of spawn processes.
     """
 
index e9999e27d5f5358a752ecce21f043b57cb1b327c..3d1d93e113fd71dfbdd6b477cde38c8c0359042b 100644 (file)
@@ -440,7 +440,7 @@ def namedtuple(typename, field_names, *, rename=False, defaults=None, module=Non
         '__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,
index 18713722a764ad59726e4ece6a8ddcd2fc344a7c..23712fa8709d4773b8c6432dc0de942104217307 100644 (file)
@@ -1189,7 +1189,7 @@ def make_dataclass(cls_name, fields, *, bases=(), namespace=None, init=True,
             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:
index 452c6ad50846926db965f3ab5c3fb3a79dfd07f4..8d1a2025271ff97a2121cd9bf5888c2f8db434cc 100644 (file)
@@ -245,7 +245,7 @@ class BaseHeader(str):
         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'),
index 1bafc242c51854a9fc1adb0e4fa62afb201dad0b..5aac048060c29c32790f2ccf3040e35a3b1c7413 100644 (file)
@@ -261,7 +261,7 @@ _code_type = type(_write_atomic.__code__)
 #     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)
 #     Python 3.8a1  3400 (move frame block handling to compiler #17611)
 #     Python 3.8a1  3401 (add END_ASYNC_FOR #33041)
index 0d83fe54f4cb5afbd837552a2bb1f87f3a6dfd48..1ada1f927d9c0be8abb8f6ee6ee4a31ec2800078 100644 (file)
@@ -2976,7 +2976,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:
index cb0e18c242d100f8122faf7c62fa7740a46c66a4..facf9d2e2c053e5b06cfe8a07e0af6bf528e83f1 100755 (executable)
@@ -3043,11 +3043,11 @@ class TestMakeDataclass(unittest.TestCase):
     def test_non_identifier_field_names(self):
         for field in ['()', 'x,y', '*', '2@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):
index f61efa3c648e6677631a0f14194205a033f63389..a5f8f6465e88b8a966be488f462e8c1a3b6438cf 100644 (file)
@@ -22,7 +22,7 @@ class EINTRTests(unittest.TestCase):
             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: "
index c9e6e7de5afdbf7482ed3b9b45ab7258d0ab0a98..fb761441fcee5cfec18fd33be276759a88b6a1b4 100644 (file)
@@ -1161,7 +1161,7 @@ non-important content
 
         # These next lines contains tabs.  Backslash escapes don't
         # work in f-strings.
-        # patchcheck doens't like these tabs.  So the only way to test
+        # patchcheck doesn't like these tabs.  So the only way to test
         # this will be to dynamically created and exec the f-strings.  But
         # that's such a hassle I'll save it for another day.  For now, convert
         # the tabs to spaces just to shut up patchcheck.
index 844ed26c3ec79f109a116e8223b833a8a3ef0ee9..5e2cb264e28a73421c4b30cb5ec2c77db38e69f2 100644 (file)
@@ -32,7 +32,7 @@ class BasicTests(fixtures.DistInfoPkg, unittest.TestCase):
 class ImportTests(fixtures.DistInfoPkg, unittest.TestCase):
     def test_import_nonexistent_module(self):
         # Ensure that the MetadataPathFinder does not crash an import of a
-        # non-existant module.
+        # nonexistent module.
         with self.assertRaises(ImportError):
             importlib.import_module('does_not_exist')
 
index 96af655061f62c324a78afcdfc1c56211d3a989b..90b8b7b4a9e3b4733a233db5b8ec23d9e9e3aa99 100644 (file)
@@ -1868,7 +1868,7 @@ class IsCloseTests(unittest.TestCase):
     def testPerm(self):
         perm = math.perm
         factorial = math.factorial
-        # Test if factorial defintion is satisfied
+        # Test if factorial definition is satisfied
         for n in range(100):
             for k in range(n + 1):
                 self.assertEqual(perm(n, k),
@@ -1932,7 +1932,7 @@ class IsCloseTests(unittest.TestCase):
     def testComb(self):
         comb = math.comb
         factorial = math.factorial
-        # Test if factorial defintion is satisfied
+        # Test if factorial definition is satisfied
         for n in range(100):
             for k in range(n + 1):
                 self.assertEqual(comb(n, k), factorial(n)
index ff1ddcaf140745160d98562edb1f961d768ffa73..899ca108c65d985613c5c6be1431738017079dc4 100644 (file)
@@ -228,7 +228,7 @@ class TestBasicOps:
             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.
index 3036625d735821eb96267be8c79e026174260de5..d891fa0880dad1e8f98405e0d593ddd9aaaf980e 100644 (file)
@@ -2005,7 +2005,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.
 
 ..
index dc08e42fb7e10b2861b49df5202ac947e42a130b..3fa356c56d94a07895aea696cea7bb4d2ecb3479 100644 (file)
@@ -3694,7 +3694,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.
 
 ..
index 759436028b661c56df98598a96049c4922048cad..4dc2eef5d3b61bdf3a3763311e781d04c25c38ee 100644 (file)
@@ -877,7 +877,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.
 
 ..
 
index 84c2a6c12bcfa63d059c496f1081db5d8942c5b3..3d376693d380ceefcd6ffc4b504c9c133a184734 100644 (file)
@@ -1358,7 +1358,7 @@ Improved syntax error messages for unbalanced parentheses.
 .. section: Core and Builtins
 
 The list constructor will pre-size and not over-allocate when the input
-lenght is known.
+length is known.
 
 ..
 
index 34e11bd5f820cdb9e9b08c031e934f2f0efc5dfd..0a597575b3584af8d6ff64349dddb69eb239fc1f 100644 (file)
@@ -2119,7 +2119,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
index 16104e492ab10327666c8384d9dcc3b8feba74c5..1821eb2a0f017b1765460473ad9698d60138f5b6 100644 (file)
@@ -210,7 +210,7 @@ static int fuzz_sre_compile(const char* data, size_t size) {
 
 /* Some random patterns used to test re.match.
    Be careful not to add catostraphically slow regexes here, we want to
-   excercise the matching code without causing timeouts.*/
+   exercise the matching code without causing timeouts.*/
 static const char* regex_patterns[] = {
     ".", "^", "abc", "abc|def", "^xxx$", "\\b", "()", "[a-zA-Z0-9]",
     "abc+", "[^A-Z]", "[x]", "(?=)", "a{z}", "a+b", "a*?", "a??", "a+?",
index 1c7078a6b5708ae6e6a1aa15b24e21d997471564..dd8dd7aeefc69b7e058994a39a641b85953e70d8 100644 (file)
@@ -300,7 +300,7 @@ PyStatus
 PyWideStringList_Append(PyWideStringList *list, const wchar_t *item)
 {
     if (list->length == PY_SSIZE_T_MAX) {
-        /* lenght+1 would overflow */
+        /* length+1 would overflow */
         return _PyStatus_NO_MEMORY();
     }