Skip to content

Commit

Permalink
Fix typos in docs, comments and test assert messages (python#14872)
Browse files Browse the repository at this point in the history
  • Loading branch information
minho42 authored and terryjreedy committed Jul 21, 2019
1 parent 8e3a738 commit 96e12d5
Show file tree
Hide file tree
Showing 21 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion Doc/library/ctypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion Lib/asyncio/unix_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""

Expand Down
2 changes: 1 addition & 1 deletion Lib/collections/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,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,
Expand Down
2 changes: 1 addition & 1 deletion Lib/dataclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -1189,7 +1189,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:
Expand Down
2 changes: 1 addition & 1 deletion Lib/email/headerregistry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down
2 changes: 1 addition & 1 deletion Lib/importlib/_bootstrap_external.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,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)
# Python 3.8a1 3400 (move frame block handling to compiler #17611)
# Python 3.8a1 3401 (add END_ASYNC_FOR #33041)
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/support/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2978,7 +2978,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:
Expand Down
6 changes: 3 additions & 3 deletions Lib/test/test_dataclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -3043,11 +3043,11 @@ def test_keyword_field_names(self):
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):
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_eintr.py
Original file line number Diff line number Diff line change
Expand Up @@ -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: "
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_fstring.py
Original file line number Diff line number Diff line change
Expand Up @@ -1161,7 +1161,7 @@ def __repr__(self):

# 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.
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_importlib/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def test_new_style_classes(self):
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')

Expand Down
4 changes: 2 additions & 2 deletions Lib/test/test_math.py
Original file line number Diff line number Diff line change
Expand Up @@ -1875,7 +1875,7 @@ def test_fractions(self):
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),
Expand Down Expand Up @@ -1939,7 +1939,7 @@ def testPerm(self):
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)
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_random.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion Misc/NEWS.d/3.5.2rc1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.

..
Expand Down
2 changes: 1 addition & 1 deletion Misc/NEWS.d/3.6.0a1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.

..
Expand Down
2 changes: 1 addition & 1 deletion Misc/NEWS.d/3.6.3rc1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.

..
Expand Down
2 changes: 1 addition & 1 deletion Misc/NEWS.d/3.8.0a1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.

..
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Many ``PyRun_XXX()`` functions like :c:func:`PyRun_String` were no longer
exported in ``libpython38.dll`` by mistake. Export them again to fix the ABI
compatibiliy.
compatibility.
2 changes: 1 addition & 1 deletion Modules/_pickle.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Modules/_xxtestfuzz/fuzzer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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+?",
Expand Down
2 changes: 1 addition & 1 deletion Python/initconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down

0 comments on commit 96e12d5

Please sign in to comment.