Skip to content

Commit

Permalink
Fix typos
Browse files Browse the repository at this point in the history
This has two goals: Improve the "typos" spell checker but also increase
the quality of the cPython source code.

This was done using two spell checkers. Does this fix all typos? Most
certainly it does not.
  • Loading branch information
ember91 committed Oct 14, 2024
1 parent 5dac0dc commit 5b7c37a
Show file tree
Hide file tree
Showing 144 changed files with 282 additions and 282 deletions.
2 changes: 1 addition & 1 deletion .github/problem-matchers/gcc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"__comment": "Taken from vscode-cpptools's Extension/package.json gcc rule",
"__comment": "Taken from vscode-cpptools' Extension/package.json gcc rule",
"problemMatcher": [
{
"owner": "gcc-problem-matcher",
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ jobs:
with:
config_hash: ${{ needs.check_source.outputs.config_hash }}
options: ./configure --config-cache --with-thread-sanitizer --with-pydebug
suppressions_path: Tools/tsan/supressions.txt
suppressions_path: Tools/tsan/suppressions.txt
tsan_logs_artifact_name: tsan-logs-default

build_tsan_free_threading:
Expand Down
2 changes: 1 addition & 1 deletion Doc/c-api/init.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2418,7 +2418,7 @@ Example usage::
In the above example, :c:macro:`Py_SETREF` calls :c:macro:`Py_DECREF`, which
can call arbitrary code through an object's deallocation function. The critical
section API avoids potentital deadlocks due to reentrancy and lock ordering
section API avoids potential deadlocks due to reentrancy and lock ordering
by allowing the runtime to temporarily suspend the critical section if the
code triggered by the finalizer blocks and calls :c:func:`PyEval_SaveThread`.
Expand Down
2 changes: 1 addition & 1 deletion Doc/c-api/long.rst
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
free(bignum);
*flags* is either ``-1`` (``Py_ASNATIVEBYTES_DEFAULTS``) to select defaults
that behave most like a C cast, or a combintation of the other flags in
that behave most like a C cast, or a combination of the other flags in
the table below.
Note that ``-1`` cannot be combined with other flags.
Expand Down
2 changes: 1 addition & 1 deletion Doc/c-api/monitoring.rst
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ would typically correspond to a python function.
The ``version`` argument is a pointer to a value which should be allocated
by the user together with ``state_array`` and initialized to 0,
and then set only by :c:func:`!PyMonitoring_EnterScope` itelf. It allows this
and then set only by :c:func:`!PyMonitoring_EnterScope` itself. It allows this
function to determine whether event states have changed since the previous call,
and to return quickly if they have not.
Expand Down
2 changes: 1 addition & 1 deletion Doc/library/concurrent.futures.rst
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ ThreadPoolExecutor Example
'http://www.cnn.com/',
'http://europe.wsj.com/',
'http://www.bbc.co.uk/',
'http://nonexistant-subdomain.python.org/']
'http://nonexistent-subdomain.python.org/']

# Retrieve a single page and report the URL and contents
def load_url(url, timeout):
Expand Down
2 changes: 1 addition & 1 deletion Doc/library/importlib.metadata.rst
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ path.

``DatabaseDistribution``, then, would look something like::

class DatabaseDistribution(importlib.metadata.Distributon):
class DatabaseDistribution(importlib.metadata.Distribution):
def __init__(self, record):
self.record = record

Expand Down
4 changes: 2 additions & 2 deletions Doc/using/windows.rst
Original file line number Diff line number Diff line change
Expand Up @@ -838,8 +838,8 @@ The short form of the argument (``-3``) only ever selects from core Python
releases, and not other distributions. However, the longer form (``-V:3``) will
select from any.

The Company is matched on the full string, case-insenitive. The Tag is matched
oneither the full string, or a prefix, provided the next character is a dot or a
The Company is matched on the full string, case-insensitive. The Tag is matched
on either the full string, or a prefix, provided the next character is a dot or a
hyphen. This allows ``-V:3.1`` to match ``3.1-32``, but not ``3.10``. Tags are
sorted using numerical ordering (``3.10`` is newer than ``3.1``), but are
compared using text (``-V:3.01`` does not match ``3.1``).
Expand Down
4 changes: 2 additions & 2 deletions Include/cpython/critical_section.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ PyCriticalSection2_End(PyCriticalSection2 *c);
}
#else /* !Py_GIL_DISABLED */

// NOTE: the contents of this struct are private and may change betweeen
// NOTE: the contents of this struct are private and may change between
// Python releases without a deprecation period.
struct PyCriticalSection {
// Tagged pointer to an outer active critical section (or 0).
Expand All @@ -105,7 +105,7 @@ struct PyCriticalSection {

// A critical section protected by two mutexes. Use
// Py_BEGIN_CRITICAL_SECTION2 and Py_END_CRITICAL_SECTION2.
// NOTE: the contents of this struct are private and may change betweeen
// NOTE: the contents of this struct are private and may change between
// Python releases without a deprecation period.
struct PyCriticalSection2 {
PyCriticalSection _cs_base;
Expand Down
2 changes: 1 addition & 1 deletion Include/internal/pycore_code.h
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ adaptive_counter_backoff(_Py_BackoffCounter counter) {

/*
* The following bits are chosen so that the value of
* COMPARSION_BIT(left, right)
* COMPARISON_BIT(left, right)
* masked by the values below will be non-zero if the
* comparison is true, and zero if it is false */

Expand Down
4 changes: 2 additions & 2 deletions Include/internal/pycore_critical_section.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ extern "C" {

// Asserts that the mutex is locked. The mutex must be held by the
// top-most critical section otherwise there's the possibility
// that the mutex would be swalled out in some code paths.
// that the mutex would be stalled out in some code paths.
#define _Py_CRITICAL_SECTION_ASSERT_MUTEX_LOCKED(mutex) \
_PyCriticalSection_AssertHeld(mutex)

// Asserts that the mutex for the given object is locked. The mutex must
// be held by the top-most critical section otherwise there's the
// possibility that the mutex would be swalled out in some code paths.
// possibility that the mutex would be stalled out in some code paths.
#ifdef Py_DEBUG

# define _Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED(op) \
Expand Down
2 changes: 1 addition & 1 deletion Include/internal/pycore_hamt.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ cell in the 7th level of the tree -- so we'd put them in a "collision" node.
Which brings the total possible tree depth to 8. Read more about the actual
layout of the HAMT tree in `hamt.c`.
This constant is used to define a datastucture for storing iteration state.
This constant is used to define a datastructure for storing iteration state.
*/
#define _Py_HAMT_MAX_TREE_DEPTH 8

Expand Down
2 changes: 1 addition & 1 deletion Include/internal/pycore_lock.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ PyAPI_FUNC(void) _PyRWMutex_Unlock(_PyRWMutex *rwmutex);
// sequence has not changed the data is valid.
//
// Differs a little bit in that we use CAS on sequence as the lock, instead of a separate spin lock.
// The writer can also detect that the undelering data has not changed and abandon the write
// The writer can also detect that the underlying data has not changed and abandon the write
// and restore the previous sequence.
typedef struct {
uint32_t sequence;
Expand Down
4 changes: 2 additions & 2 deletions Include/internal/pycore_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ extern void _Py_ForgetReference(PyObject *);
PyAPI_FUNC(int) _PyObject_IsFreed(PyObject *);

/* We need to maintain an internal copy of Py{Var}Object_HEAD_INIT to avoid
designated initializer conflicts in C++20. If we use the deinition in
designated initializer conflicts in C++20. If we use the definition in
object.h, we will be mixing designated and non-designated initializers in
pycore objects which is forbiddent in C++20. However, if we then use
pycore objects which is forbidden in C++20. However, if we then use
designated initializers in object.h then Extensions without designated break.
Furthermore, we can't use designated initializers in Extensions since these
are not supported pre-C++20. Thus, keeping an internal copy here is the most
Expand Down
2 changes: 1 addition & 1 deletion Include/unicodeobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,7 @@ PyAPI_FUNC(PyObject*) PyUnicode_Split(
Py_ssize_t maxsplit /* Maxsplit count */
);

/* Dito, but split at line breaks.
/* Ditto, but split at line breaks.
CRLF is considered to be one line break. Line breaks are not
included in the resulting list. */
Expand Down
2 changes: 1 addition & 1 deletion InternalDocs/adaptive.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ and `Tadaptive` is the mean time to execute the specialized and adaptive forms.

`Ti` is the time to execute the `i`th instruction in the family and `Ni` is
the number of times that instruction is executed.
`Tmiss` is the time to process a miss, including de-optimzation
`Tmiss` is the time to process a miss, including de-optimization
and the time to execute the base instruction.

The ideal situation is where misses are rare and the specialized
Expand Down
2 changes: 1 addition & 1 deletion Lib/_pyio.py
Original file line number Diff line number Diff line change
Expand Up @@ -2381,7 +2381,7 @@ def tell(self):
assert skip_bytes <= len(next_input)
while skip_bytes > 0:
decoder.setstate((b'', dec_flags))
# Decode up to temptative start point
# Decode up to tentative start point
n = len(decoder.decode(next_input[:skip_bytes]))
if n <= chars_to_skip:
b, d = decoder.getstate()
Expand Down
2 changes: 1 addition & 1 deletion Lib/_pyrepl/unix_console.py
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,7 @@ def __tputs(self, fmt, prog=delayprog):
will never do anyone any good."""
# using .get() means that things will blow up
# only if the bps is actually needed (which I'm
# betting is pretty unlkely)
# betting is pretty unlikely)
bps = ratedict.get(self.__svtermstate.ospeed)
while 1:
m = prog.search(fmt)
Expand Down
2 changes: 1 addition & 1 deletion Lib/bdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,7 @@ def effective(file, line, frame):
must exist) that is enabled, for which checkfuncname is True, and that
has neither a False condition nor a positive ignore count. The flag,
meaning that a temporary breakpoint should be deleted, is False only
when the condiion cannot be evaluated (in which case, ignore count is
when the condition cannot be evaluated (in which case, ignore count is
ignored).
If no such entry exists, then (None, None) is returned.
Expand Down
2 changes: 1 addition & 1 deletion Lib/difflib.py
Original file line number Diff line number Diff line change
Expand Up @@ -927,7 +927,7 @@ def _fancy_replace(self, a, alo, ahi, b, blo, bhi):
dump_i, dump_j = alo, blo # smallest indices not yet resolved
for j in range(blo, bhi):
cruncher.set_seq2(b[j])
# Search the corresponding i's within WINDOW for rhe highest
# Search the corresponding i's within WINDOW for the highest
# ratio greater than `cutoff`.
aequiv = alo + (j - blo)
arange = range(max(aequiv - WINDOW, dump_i),
Expand Down
2 changes: 1 addition & 1 deletion Lib/email/_header_value_parser.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Header value parser implementing various email-related RFC parsing rules.
The parsing methods defined in this module implement various email related
parsing rules. Principal among them is RFC 5322, which is the followon
parsing rules. Principal among them is RFC 5322, which is the followup
to RFC 2822 and primarily a clarification of the former. It also implements
RFC 2047 encoded word decoding.
Expand Down
4 changes: 2 additions & 2 deletions Lib/idlelib/help.html
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ <h3>Key bindings<a class="headerlink" href="#key-bindings" title="Permalink to t
delete characters. Deletion does not puts text on the clipboard,
but IDLE has an undo list. Wherever this doc discusses keys,
‘C’ refers to the <kbd class="kbd docutils literal notranslate">Control</kbd> key on Windows and
Unix and the <kbd class="kbd docutils literal notranslate">Command</kbd> key on macOS. (And all such dicussions
Unix and the <kbd class="kbd docutils literal notranslate">Command</kbd> key on macOS. (And all such discussions
assume that the keys have not been re-bound to something else.)</p>
<ul class="simple">
<li><p>Arrow keys move the cursor one character or line.</p></li>
Expand Down Expand Up @@ -694,7 +694,7 @@ <h3>Shell window<a class="headerlink" href="#shell-window" title="Permalink to t
<p>The editing features described in previous subsections work when entering
code interactively. IDLE’s Shell window also responds to the following:</p>
<ul class="simple">
<li><p><kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">c</kbd></kbd> attemps to interrupt statement execution (but may fail).</p></li>
<li><p><kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">c</kbd></kbd> attempts to interrupt statement execution (but may fail).</p></li>
<li><p><kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">d</kbd></kbd> closes Shell if typed at a <code class="docutils literal notranslate"><span class="pre">&gt;&gt;&gt;</span></code> prompt.</p></li>
<li><p><kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">Alt</kbd>-<kbd class="kbd docutils literal notranslate">p</kbd></kbd> and <kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">Alt</kbd>-<kbd class="kbd docutils literal notranslate">n</kbd></kbd> (<kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">p</kbd></kbd> and <kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">n</kbd></kbd> on macOS)
retrieve to the current prompt the previous or next previously
Expand Down
12 changes: 6 additions & 6 deletions Lib/idlelib/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@ def handle_tk_events(tcl=tcl):

# Thread shared globals: Establish a queue between a subthread (which handles
# the socket) and the main thread (which runs user code), plus global
# completion, exit and interruptable (the main thread) flags:
# completion, exit and interruptible (the main thread) flags:

exit_now = False
quitting = False
interruptable = False
interruptible = False

def main(del_exitfunc=False):
"""Start the Python execution server in a subprocess
Expand Down Expand Up @@ -582,14 +582,14 @@ def __init__(self, rpchandler):
self.locals = {}

def runcode(self, code):
global interruptable
global interruptible
try:
self.user_exc_info = None
interruptable = True
interruptible = True
try:
exec(code, self.locals)
finally:
interruptable = False
interruptible = False
except SystemExit as e:
if e.args: # SystemExit called with an argument.
ob = e.args[0]
Expand All @@ -615,7 +615,7 @@ def runcode(self, code):
flush_stdout()

def interrupt_the_server(self):
if interruptable:
if interruptible:
thread.interrupt_main()

def start_the_debugger(self, gui_adap_oid):
Expand Down
2 changes: 1 addition & 1 deletion Lib/pdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -2428,7 +2428,7 @@ def main():
formatter_class=argparse.RawDescriptionHelpFormatter,
allow_abbrev=False)

# We need to maunally get the script from args, because the first positional
# We need to manually get the script from args, because the first positional
# arguments could be either the script we need to debug, or the argument
# to the -m module
parser.add_argument('-c', '--command', action='append', default=[], metavar='command', dest='commands',
Expand Down
16 changes: 8 additions & 8 deletions Lib/shutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class RegistryError(Exception):
"""Raised when a registry operation with the archiving
and unpacking registries fails"""

class _GiveupOnFastCopy(Exception):
class _GiveUpOnFastCopy(Exception):
"""Raised as a signal to fallback on using raw read()/write()
file copy when fast-copy functions fail to do so.
"""
Expand All @@ -95,15 +95,15 @@ def _fastcopy_fcopyfile(fsrc, fdst, flags):
infd = fsrc.fileno()
outfd = fdst.fileno()
except Exception as err:
raise _GiveupOnFastCopy(err) # not a regular file
raise _GiveUpOnFastCopy(err) # not a regular file

try:
posix._fcopyfile(infd, outfd, flags)
except OSError as err:
err.filename = fsrc.name
err.filename2 = fdst.name
if err.errno in {errno.EINVAL, errno.ENOTSUP}:
raise _GiveupOnFastCopy(err)
raise _GiveUpOnFastCopy(err)
else:
raise err from None

Expand All @@ -126,7 +126,7 @@ def _fastcopy_sendfile(fsrc, fdst):
infd = fsrc.fileno()
outfd = fdst.fileno()
except Exception as err:
raise _GiveupOnFastCopy(err) # not a regular file
raise _GiveUpOnFastCopy(err) # not a regular file

# Hopefully the whole file will be copied in a single call.
# sendfile() is called in a loop 'till EOF is reached (0 return)
Expand Down Expand Up @@ -156,14 +156,14 @@ def _fastcopy_sendfile(fsrc, fdst):
# does not support copies between regular files (only
# sockets).
_USE_CP_SENDFILE = False
raise _GiveupOnFastCopy(err)
raise _GiveUpOnFastCopy(err)

if err.errno == errno.ENOSPC: # filesystem is full
raise err from None

# Give up on first call and if no data was copied.
if offset == 0 and os.lseek(outfd, 0, os.SEEK_CUR) == 0:
raise _GiveupOnFastCopy(err)
raise _GiveUpOnFastCopy(err)

raise err
else:
Expand Down Expand Up @@ -263,14 +263,14 @@ def copyfile(src, dst, *, follow_symlinks=True):
try:
_fastcopy_fcopyfile(fsrc, fdst, posix._COPYFILE_DATA)
return dst
except _GiveupOnFastCopy:
except _GiveUpOnFastCopy:
pass
# Linux / Android / Solaris
elif _USE_CP_SENDFILE:
try:
_fastcopy_sendfile(fsrc, fdst)
return dst
except _GiveupOnFastCopy:
except _GiveUpOnFastCopy:
pass
# Windows, see:
# https://github.com/python/cpython/pull/7160#discussion_r195405230
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/decimaltestdata/ddQuantize.decTest
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ ddqua520 quantize 1.234 1e359 -> 0E+359 Inexact Rounded
ddqua521 quantize 123.456 1e359 -> 0E+359 Inexact Rounded
ddqua522 quantize 1.234 1e359 -> 0E+359 Inexact Rounded
ddqua523 quantize 123.456 1e359 -> 0E+359 Inexact Rounded
-- next four are "won't fit" overflow
-- next four are "won't fit" overflows
ddqua526 quantize 1.234 1e-299 -> NaN Invalid_operation
ddqua527 quantize 123.456 1e-299 -> NaN Invalid_operation
ddqua528 quantize 1.234 1e-299 -> NaN Invalid_operation
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/libregrtest/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

# Other resources excluded from --use=all:
#
# - extralagefile (ex: test_zipfile64): really too slow to be enabled
# - extralargefile (ex: test_zipfile64): really too slow to be enabled
# "by default"
# - tzdata: while needed to validate fully test_datetime, it makes
# test_datetime too slow (15-20 min on some buildbots) and so is disabled by
Expand Down
4 changes: 2 additions & 2 deletions Lib/test/support/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2203,7 +2203,7 @@ def wait_process(pid, *, exitcode, timeout=None):
pid2, status = os.waitpid(pid, os.WNOHANG)
if pid2 != 0:
break
# rety: the process is still running
# retry: the process is still running
else:
try:
os.kill(pid, signal.SIGKILL)
Expand Down Expand Up @@ -2570,7 +2570,7 @@ class CPUStopwatch:
N.B.:
- This *includes* time spent in other threads.
- Some systems only have a coarse resolution; check
stopwatch.clock_info.rseolution if.
stopwatch.clock_info.resolution if.
Usage:
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_argparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -2862,7 +2862,7 @@ def test_single_parent_mutex(self):
parser = ErrorRaisingArgumentParser(parents=[self.ab_mutex_parent])
self._test_mutex_ab(parser.parse_args)

def test_single_granparent_mutex(self):
def test_single_grandparent_mutex(self):
parents = [self.ab_mutex_parent]
parser = ErrorRaisingArgumentParser(add_help=False, parents=parents)
parser = ErrorRaisingArgumentParser(parents=[parser])
Expand Down
Loading

0 comments on commit 5b7c37a

Please sign in to comment.