Skip to content

Commit 24b5b36

Browse files
aerosminho42
authored andcommitted
[3.8] Fix typos in docs, comments and test assert messages (GH-14872). (#14900)
(cherry picked from commit 96e12d5) Co-authored-by: Min ho Kim <[email protected]>
1 parent 0104841 commit 24b5b36

File tree

20 files changed

+23
-23
lines changed

20 files changed

+23
-23
lines changed

Doc/library/ctypes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1175,7 +1175,7 @@ Keep in mind that retrieving sub-objects from Structure, Unions, and Arrays
11751175
doesn't *copy* the sub-object, instead it retrieves a wrapper object accessing
11761176
the root-object's underlying buffer.
11771177

1178-
Another example that may behave different from what one would expect is this::
1178+
Another example that may behave differently from what one would expect is this::
11791179

11801180
>>> s = c_char_p()
11811181
>>> s.value = b"abc def ghi"

Lib/asyncio/unix_events.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1243,7 +1243,7 @@ class ThreadedChildWatcher(AbstractChildWatcher):
12431243
It doesn't require subscription on POSIX signal
12441244
but a thread creation is not free.
12451245
1246-
The watcher has O(1) complexity, its perfomance doesn't depend
1246+
The watcher has O(1) complexity, its performance doesn't depend
12471247
on amount of spawn processes.
12481248
"""
12491249

Lib/collections/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ def __getnewargs__(self):
440440
'__slots__': (),
441441
'_fields': field_names,
442442
'_field_defaults': field_defaults,
443-
# alternate spelling for backward compatiblity
443+
# alternate spelling for backward compatibility
444444
'_fields_defaults': field_defaults,
445445
'__new__': __new__,
446446
'_make': _make,

Lib/dataclasses.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1189,7 +1189,7 @@ class C(Base):
11891189
raise TypeError(f'Invalid field: {item!r}')
11901190

11911191
if not isinstance(name, str) or not name.isidentifier():
1192-
raise TypeError(f'Field names must be valid identifers: {name!r}')
1192+
raise TypeError(f'Field names must be valid identifiers: {name!r}')
11931193
if keyword.iskeyword(name):
11941194
raise TypeError(f'Field names must not be keywords: {name!r}')
11951195
if name in seen:

Lib/email/headerregistry.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ def fold(self, *, policy):
245245
the header name and the ': ' separator.
246246
247247
"""
248-
# At some point we need to put fws here iif it was in the source.
248+
# At some point we need to put fws here if it was in the source.
249249
header = parser.Header([
250250
parser.HeaderLabel([
251251
parser.ValueTerminal(self.name, 'header-name'),

Lib/importlib/_bootstrap_external.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ def _write_atomic(path, data, mode=0o666):
261261
# Python 3.7a2 3391 (update GET_AITER #31709)
262262
# Python 3.7a4 3392 (PEP 552: Deterministic pycs #31650)
263263
# Python 3.7b1 3393 (remove STORE_ANNOTATION opcode #32550)
264-
# Python 3.7b5 3394 (restored docstring as the firts stmt in the body;
264+
# Python 3.7b5 3394 (restored docstring as the first stmt in the body;
265265
# this might affected the first line number #32911)
266266
# Python 3.8a1 3400 (move frame block handling to compiler #17611)
267267
# Python 3.8a1 3401 (add END_ASYNC_FOR #33041)

Lib/test/support/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2976,7 +2976,7 @@ def fd_count():
29762976
if sys.platform.startswith(('linux', 'freebsd')):
29772977
try:
29782978
names = os.listdir("/proc/self/fd")
2979-
# Substract one because listdir() opens internally a file
2979+
# Subtract one because listdir() internally opens a file
29802980
# descriptor to list the content of the /proc/self/fd/ directory.
29812981
return len(names) - 1
29822982
except FileNotFoundError:

Lib/test/test_dataclasses.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3043,11 +3043,11 @@ def test_keyword_field_names(self):
30433043
def test_non_identifier_field_names(self):
30443044
for field in ['()', 'x,y', '*', '2@3', '', 'little johnny tables']:
30453045
with self.subTest(field=field):
3046-
with self.assertRaisesRegex(TypeError, 'must be valid identifers'):
3046+
with self.assertRaisesRegex(TypeError, 'must be valid identifiers'):
30473047
make_dataclass('C', ['a', field])
3048-
with self.assertRaisesRegex(TypeError, 'must be valid identifers'):
3048+
with self.assertRaisesRegex(TypeError, 'must be valid identifiers'):
30493049
make_dataclass('C', [field])
3050-
with self.assertRaisesRegex(TypeError, 'must be valid identifers'):
3050+
with self.assertRaisesRegex(TypeError, 'must be valid identifiers'):
30513051
make_dataclass('C', [field, 'a'])
30523052

30533053
def test_underscore_field_names(self):

Lib/test/test_eintr.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def test_all(self):
2222
print()
2323
print("--- run eintr_tester.py ---", flush=True)
2424
# In verbose mode, the child process inherit stdout and stdout,
25-
# to see output in realtime and reduce the risk of loosing output.
25+
# to see output in realtime and reduce the risk of losing output.
2626
args = [sys.executable, "-E", "-X", "faulthandler", *args]
2727
proc = subprocess.run(args)
2828
print(f"--- eintr_tester.py completed: "

Lib/test/test_fstring.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1161,7 +1161,7 @@ def __repr__(self):
11611161

11621162
# These next lines contains tabs. Backslash escapes don't
11631163
# work in f-strings.
1164-
# patchcheck doens't like these tabs. So the only way to test
1164+
# patchcheck doesn't like these tabs. So the only way to test
11651165
# this will be to dynamically created and exec the f-strings. But
11661166
# that's such a hassle I'll save it for another day. For now, convert
11671167
# the tabs to spaces just to shut up patchcheck.

Lib/test/test_importlib/test_main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def test_new_style_classes(self):
3232
class ImportTests(fixtures.DistInfoPkg, unittest.TestCase):
3333
def test_import_nonexistent_module(self):
3434
# Ensure that the MetadataPathFinder does not crash an import of a
35-
# non-existant module.
35+
# nonexistent module.
3636
with self.assertRaises(ImportError):
3737
importlib.import_module('does_not_exist')
3838

Lib/test/test_math.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1868,7 +1868,7 @@ def test_fractions(self):
18681868
def testPerm(self):
18691869
perm = math.perm
18701870
factorial = math.factorial
1871-
# Test if factorial defintion is satisfied
1871+
# Test if factorial definition is satisfied
18721872
for n in range(100):
18731873
for k in range(n + 1):
18741874
self.assertEqual(perm(n, k),
@@ -1932,7 +1932,7 @@ def testPerm(self):
19321932
def testComb(self):
19331933
comb = math.comb
19341934
factorial = math.factorial
1935-
# Test if factorial defintion is satisfied
1935+
# Test if factorial definition is satisfied
19361936
for n in range(100):
19371937
for k in range(n + 1):
19381938
self.assertEqual(comb(n, k), factorial(n)

Lib/test/test_random.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ def test_choices(self):
228228
choices([], cum_weights=[], k=5)
229229

230230
def test_choices_subnormal(self):
231-
# Subnormal weights would occassionally trigger an IndexError
231+
# Subnormal weights would occasionally trigger an IndexError
232232
# in choices() when the value returned by random() was large
233233
# enough to make `random() * total` round up to the total.
234234
# See https://bugs.python.org/msg275594 for more detail.

Misc/NEWS.d/3.5.2rc1.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2005,7 +2005,7 @@ Adds validation of ucrtbase[d].dll version with warning for old versions.
20052005
.. nonce: 102DA-
20062006
.. section: Build
20072007
2008-
Avoid error about nonexistant fileblocks.o file by using a lower-level check
2008+
Avoid error about nonexistent fileblocks.o file by using a lower-level check
20092009
for st_blocks in struct stat.
20102010

20112011
..

Misc/NEWS.d/3.6.0a1.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3694,7 +3694,7 @@ Adds validation of ucrtbase[d].dll version with warning for old versions.
36943694
.. nonce: 102DA-
36953695
.. section: Build
36963696
3697-
Avoid error about nonexistant fileblocks.o file by using a lower-level check
3697+
Avoid error about nonexistent fileblocks.o file by using a lower-level check
36983698
for st_blocks in struct stat.
36993699

37003700
..

Misc/NEWS.d/3.6.3rc1.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -877,7 +877,7 @@ The affected events are '<<force-open-completions>>', '<<expand-word>>',
877877
'<<run-module>>', '<<check-module>>', and '<<zoom-height>>'. Any (global)
878878
customizations made before 3.6.3 will not affect their keyset-specific
879879
customization after 3.6.3. and vice versa.
880-
Inital patch by Charles Wohlganger.
880+
Initial patch by Charles Wohlganger.
881881

882882
..
883883

Misc/NEWS.d/3.8.0a1.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1358,7 +1358,7 @@ Improved syntax error messages for unbalanced parentheses.
13581358
.. section: Core and Builtins
13591359
13601360
The list constructor will pre-size and not over-allocate when the input
1361-
lenght is known.
1361+
length is known.
13621362

13631363
..
13641364

Modules/_pickle.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2119,7 +2119,7 @@ save_long(PicklerObject *self, PyObject *obj)
21192119
/* How many bytes do we need? There are nbits >> 3 full
21202120
* bytes of data, and nbits & 7 leftover bits. If there
21212121
* are any leftover bits, then we clearly need another
2122-
* byte. Wnat's not so obvious is that we *probably*
2122+
* byte. What's not so obvious is that we *probably*
21232123
* need another byte even if there aren't any leftovers:
21242124
* the most-significant bit of the most-significant byte
21252125
* acts like a sign bit, and it's usually got a sense

Modules/_xxtestfuzz/fuzzer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ static int fuzz_sre_compile(const char* data, size_t size) {
210210

211211
/* Some random patterns used to test re.match.
212212
Be careful not to add catostraphically slow regexes here, we want to
213-
excercise the matching code without causing timeouts.*/
213+
exercise the matching code without causing timeouts.*/
214214
static const char* regex_patterns[] = {
215215
".", "^", "abc", "abc|def", "^xxx$", "\\b", "()", "[a-zA-Z0-9]",
216216
"abc+", "[^A-Z]", "[x]", "(?=)", "a{z}", "a+b", "a*?", "a??", "a+?",

Python/initconfig.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ PyStatus
300300
PyWideStringList_Append(PyWideStringList *list, const wchar_t *item)
301301
{
302302
if (list->length == PY_SSIZE_T_MAX) {
303-
/* lenght+1 would overflow */
303+
/* length+1 would overflow */
304304
return _PyStatus_NO_MEMORY();
305305
}
306306

0 commit comments

Comments
 (0)