Skip to content

Commit 253c6a0

Browse files
authored
Fix typos in comments and test code (#122846)
1 parent 9375b9c commit 253c6a0

File tree

18 files changed

+28
-28
lines changed

18 files changed

+28
-28
lines changed

Lib/_pylong.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ def inner(n, w):
348348
# off-by-1 error too low. So we add 2 instead of 1 if chopping lost
349349
# a fraction > 0.9.
350350

351-
# The "WASI" test platfrom can complain about `len(s)` if it's too
351+
# The "WASI" test platform can complain about `len(s)` if it's too
352352
# large to fit in its idea of "an index-sized integer".
353353
lenS = s.__len__()
354354
log_ub = lenS * _LOG_10_BASE_256
@@ -613,7 +613,7 @@ def int_divmod(a, b):
613613
# ctx.prec = max(n.adjusted() - p256.adjusted(), 0) + GUARD
614614
# hi = +n * +recip # unary `+` chops to ctx.prec digits
615615
#
616-
# we have 3 visible chopped operationa, but there's also a 4th:
616+
# we have 3 visible chopped operations, but there's also a 4th:
617617
# precomputing a truncated `recip` as part of setup.
618618
#
619619
# So the computed product is exactly equal to the true product times
@@ -703,7 +703,7 @@ def int_divmod(a, b):
703703
# Enable for brute-force testing of compute_powers(). This takes about a
704704
# minute, because it tries millions of cases.
705705
if 0:
706-
def consumer(w, limir, need_hi):
706+
def consumer(w, limit, need_hi):
707707
seen = set()
708708
need = set()
709709
def inner(w):
@@ -718,7 +718,7 @@ def inner(w):
718718
inner(lo)
719719
inner(hi)
720720
inner(w)
721-
exp = compute_powers(w, 1, limir, need_hi=need_hi)
721+
exp = compute_powers(w, 1, limit, need_hi=need_hi)
722722
assert exp.keys() == need
723723

724724
from itertools import chain

Lib/_pyrepl/completing_reader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def build_menu(
9191
# D E F B E
9292
# G C F
9393
#
94-
# "fill" the table with empty words, so we always have the same amout
94+
# "fill" the table with empty words, so we always have the same amount
9595
# of rows for each column
9696
missing = cols*rows - len(wordlist)
9797
wordlist = wordlist + ['']*missing

Lib/_pyrepl/unix_console.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def add_baudrate_if_supported(dictionary: dict[int, int], rate: int) -> None:
109109
try:
110110
poll: type[select.poll] = select.poll
111111
except AttributeError:
112-
# this is exactly the minumum necessary to support what we
112+
# this is exactly the minimum necessary to support what we
113113
# do with poll objects
114114
class MinimalPoll:
115115
def __init__(self):
@@ -613,7 +613,7 @@ def __write_changed_line(self, y, oldline, newline, px_coord):
613613

614614
# reuse the oldline as much as possible, but stop as soon as we
615615
# encounter an ESCAPE, because it might be the start of an escape
616-
# sequene
616+
# sequence
617617
while (
618618
x_coord < minlen
619619
and oldline[x_pos] == newline[x_pos]

Lib/_pyrepl/windows_console.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ def __write_changed_line(
231231

232232
# reuse the oldline as much as possible, but stop as soon as we
233233
# encounter an ESCAPE, because it might be the start of an escape
234-
# sequene
234+
# sequence
235235
while (
236236
x_coord < minlen
237237
and oldline[x_pos] == newline[x_pos]

Lib/dataclasses.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ def _init_fn(fields, std_fields, kw_only_fields, frozen, has_post_init,
656656
if kw_only_fields:
657657
# Add the keyword-only args. Because the * can only be added if
658658
# there's at least one keyword-only arg, there needs to be a test here
659-
# (instead of just concatenting the lists together).
659+
# (instead of just concatenating the lists together).
660660
_init_params += ['*']
661661
_init_params += [_init_param(f) for f in kw_only_fields]
662662
func_builder.add_fn('__init__',

Lib/test/libregrtest/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ def _run_tests(self, selected: TestTuple, tests: TestList | None) -> int:
536536
self._run_tests_mp(runtests, self.num_workers)
537537
else:
538538
# gh-117783: don't immortalize deferred objects when tracking
539-
# refleaks. Only releveant for the free-threaded build.
539+
# refleaks. Only relevant for the free-threaded build.
540540
with suppress_immortalization(runtests.hunt_refleak):
541541
self.run_tests_sequentially(runtests)
542542

Lib/test/libregrtest/single.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ def run_single_test(test_name: TestName, runtests: RunTests) -> TestResult:
305305
pgo = runtests.pgo
306306
try:
307307
# gh-117783: don't immortalize deferred objects when tracking
308-
# refleaks. Only releveant for the free-threaded build.
308+
# refleaks. Only relevant for the free-threaded build.
309309
with support.suppress_immortalization(runtests.hunt_refleak):
310310
_runtest(result, runtests)
311311
except:

Lib/test/support/asynchat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# TODO: This module was deprecated and removed from CPython 3.12
2-
# Now it is a test-only helper. Any attempts to rewrite exising tests that
2+
# Now it is a test-only helper. Any attempts to rewrite existing tests that
33
# are using this module and remove it completely are appreciated!
44
# See: https://github.com/python/cpython/issues/72719
55

Lib/test/support/asyncore.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# TODO: This module was deprecated and removed from CPython 3.12
2-
# Now it is a test-only helper. Any attempts to rewrite exising tests that
2+
# Now it is a test-only helper. Any attempts to rewrite existing tests that
33
# are using this module and remove it completely are appreciated!
44
# See: https://github.com/python/cpython/issues/72719
55

Lib/test/support/bytecode_helper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class Label:
7171

7272
def assertInstructionsMatch(self, actual_seq, expected):
7373
# get an InstructionSequence and an expected list, where each
74-
# entry is a label or an instruction tuple. Construct an expcted
74+
# entry is a label or an instruction tuple. Construct an expected
7575
# instruction sequence and compare with the one given.
7676

7777
self.assertIsInstance(expected, list)

Lib/test/test_ast/test_ast.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2701,13 +2701,13 @@ def test_source_segment_missing_info(self):
27012701

27022702

27032703
class NodeTransformerTests(ASTTestMixin, unittest.TestCase):
2704-
def assertASTTransformation(self, tranformer_class,
2704+
def assertASTTransformation(self, transformer_class,
27052705
initial_code, expected_code):
27062706
initial_ast = ast.parse(dedent(initial_code))
27072707
expected_ast = ast.parse(dedent(expected_code))
27082708

2709-
tranformer = tranformer_class()
2710-
result_ast = ast.fix_missing_locations(tranformer.visit(initial_ast))
2709+
transformer = transformer_class()
2710+
result_ast = ast.fix_missing_locations(transformer.visit(initial_ast))
27112711

27122712
self.assertASTEqual(result_ast, expected_ast)
27132713

Lib/test/test_asyncio/test_locks.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,14 +1194,14 @@ async def c3(result):
11941194
self.assertEqual([2, 3], result)
11951195

11961196
async def test_acquire_fifo_order_4(self):
1197-
# Test that a successfule `acquire()` will wake up multiple Tasks
1197+
# Test that a successful `acquire()` will wake up multiple Tasks
11981198
# that were waiting in the Semaphore queue due to FIFO rules.
11991199
sem = asyncio.Semaphore(0)
12001200
result = []
12011201
count = 0
12021202

12031203
async def c1(result):
1204-
# First task immediatlly waits for semaphore. It will be awoken by c2.
1204+
# First task immediately waits for semaphore. It will be awoken by c2.
12051205
self.assertEqual(sem._value, 0)
12061206
await sem.acquire()
12071207
# We should have woken up all waiting tasks now.
@@ -1475,7 +1475,7 @@ async def coro():
14751475
# first time waiting
14761476
await barrier.wait()
14771477

1478-
# after wainting once for all tasks
1478+
# after waiting once for all tasks
14791479
if rewait_n > 0:
14801480
rewait_n -= 1
14811481
# wait again only for rewait tasks

Lib/test/test_asyncio/test_subprocess.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,7 @@ async def main() -> None:
783783

784784
def test_subprocess_protocol_events(self):
785785
# gh-108973: Test that all subprocess protocol methods are called.
786-
# The protocol methods are not called in a determistic order.
786+
# The protocol methods are not called in a deterministic order.
787787
# The order depends on the event loop and the operating system.
788788
events = []
789789
fds = [1, 2]

Lib/test/test_capi/test_opt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def f{n}():
176176
self.assertTrue(exe.is_valid())
177177
# Assert that the correct executors are invalidated
178178
# and check that nothing crashes when we invalidate
179-
# an executor mutliple times.
179+
# an executor multiple times.
180180
for i in (4,3,2,1,0):
181181
_testinternalcapi.invalidate_executors(objects[i])
182182
for exe in executors[i:]:

Lib/test/test_concurrent_futures/test_deadlock.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ def test_shutdown_deadlock_pickle(self):
236236
executor_manager.join()
237237

238238
def test_crash_big_data(self):
239-
# Test that there is a clean exception instad of a deadlock when a
239+
# Test that there is a clean exception instead of a deadlock when a
240240
# child process crashes while some data is being written into the
241241
# queue.
242242
# https://github.com/python/cpython/issues/94777

Lib/test/test_email/test__header_value_parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2773,7 +2773,7 @@ def test_get_msg_id_no_id_right(self):
27732773
parser.get_msg_id("<simplelocal@")
27742774

27752775
def test_get_msg_id_with_brackets(self):
2776-
# Microsof Outlook generates non-standard one-off addresses:
2776+
# Microsoft Outlook generates non-standard one-off addresses:
27772777
# https://learn.microsoft.com/en-us/office/client-developer/outlook/mapi/one-off-addresses
27782778
with self.assertRaises(errors.HeaderParseError):
27792779
parser.get_msg_id("<[[email protected]]>")

Lib/test/test_import/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ def test_case_sensitivity(self):
405405

406406
def test_double_const(self):
407407
# Importing double_const checks that float constants
408-
# serialiazed by marshal as PYC files don't lose precision
408+
# serialized by marshal as PYC files don't lose precision
409409
# (SF bug 422177).
410410
from test.test_import.data import double_const
411411
unload('test.test_import.data.double_const')
@@ -2926,7 +2926,7 @@ def test_basic_multiple_interpreters_main_no_reset(self):
29262926
# * alive in 1 interpreter (main)
29272927
# * module def still in _PyRuntime.imports.extensions
29282928
# * mod init func ran again
2929-
# * m_copy is NULL (claered when the interpreter was destroyed)
2929+
# * m_copy is NULL (cleared when the interpreter was destroyed)
29302930
# (was from main interpreter)
29312931
# * module's global state was updated, not reset
29322932

@@ -3061,7 +3061,7 @@ def test_basic_multiple_interpreters_reset_each(self):
30613061
# * alive in 0 interpreters
30623062
# * module def in _PyRuntime.imports.extensions
30633063
# * mod init func ran for the first time (since reset, at least)
3064-
# * m_copy is NULL (claered when the interpreter was destroyed)
3064+
# * m_copy is NULL (cleared when the interpreter was destroyed)
30653065
# * module's global state was initialized, not reset
30663066

30673067
# Use a subinterpreter that sticks around.

Lib/xml/sax/handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ def startDTD(self, name, public_id, system_id):
371371
372372
name is the name of the document element type, public_id the
373373
public identifier of the DTD (or None if none were supplied)
374-
and system_id the system identfier of the external subset (or
374+
and system_id the system identifier of the external subset (or
375375
None if none were supplied)."""
376376

377377
def endDTD(self):

0 commit comments

Comments
 (0)