From 50c5546e05e7a2c1563752ca3ae6570bbed57736 Mon Sep 17 00:00:00 2001 From: Emil Berg Date: Wed, 9 Oct 2024 12:51:02 +0200 Subject: [PATCH] Fix typos 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. --- .github/problem-matchers/gcc.json | 2 +- .github/workflows/build.yml | 2 +- Doc/c-api/init.rst | 2 +- Doc/c-api/long.rst | 2 +- Doc/c-api/monitoring.rst | 2 +- Doc/library/concurrent.futures.rst | 2 +- Doc/library/importlib.metadata.rst | 2 +- Doc/using/windows.rst | 4 +-- Include/cpython/critical_section.h | 4 +-- Include/internal/pycore_code.h | 2 +- Include/internal/pycore_critical_section.h | 4 +-- Include/internal/pycore_hamt.h | 2 +- Include/internal/pycore_lock.h | 2 +- Include/internal/pycore_object.h | 4 +-- Include/unicodeobject.h | 2 +- InternalDocs/adaptive.md | 2 +- Lib/_pyio.py | 2 +- Lib/_pyrepl/unix_console.py | 2 +- Lib/bdb.py | 2 +- Lib/difflib.py | 2 +- Lib/email/_header_value_parser.py | 2 +- Lib/idlelib/help.html | 4 +-- Lib/idlelib/run.py | 12 +++---- Lib/pdb.py | 2 +- Lib/shutil.py | 16 +++++----- Lib/test/decimaltestdata/ddQuantize.decTest | 2 +- Lib/test/libregrtest/utils.py | 2 +- Lib/test/support/__init__.py | 4 +-- Lib/test/test_argparse.py | 2 +- Lib/test/test_asyncio/test_locks.py | 10 +++--- Lib/test/test_capi/test_misc.py | 2 +- Lib/test/test_capi/test_opt.py | 2 +- Lib/test/test_cmd_line.py | 2 +- Lib/test/test_cmd_line_script.py | 2 +- Lib/test/test_code.py | 4 +-- .../test_process_pool.py | 2 +- Lib/test/test_context.py | 18 +++++------ Lib/test/test_csv.py | 2 +- Lib/test/test_dataclasses/__init__.py | 4 +-- Lib/test/test_doctest/test_doctest2.txt | 2 +- .../test_email/test__header_value_parser.py | 8 ++--- Lib/test/test_enum.py | 26 +++++++-------- Lib/test/test_file_eintr.py | 2 +- Lib/test/test_fnmatch.py | 22 ++++++------- Lib/test/test_fractions.py | 2 +- Lib/test/test_fstring.py | 2 +- Lib/test/test_heapq.py | 4 +-- Lib/test/test_httplib.py | 2 +- Lib/test/test_importlib/import_/test_api.py | 2 +- ...y_files.py => test_compatibility_files.py} | 0 .../test_importlib/resources/test_resource.py | 2 +- Lib/test/test_inspect/test_inspect.py | 2 +- Lib/test/test_interpreters/test_api.py | 4 +-- Lib/test/test_json/test_enum.py | 20 ++++++------ Lib/test/test_list.py | 2 +- Lib/test/test_monitoring.py | 2 +- Lib/test/test_peepholer.py | 2 +- Lib/test/test_plistlib.py | 32 +++++++++---------- Lib/test/test_re.py | 4 +-- Lib/test/test_resource.py | 2 +- Lib/test/test_scope.py | 2 +- Lib/test/test_shutil.py | 12 +++---- Lib/test/test_smtpnet.py | 4 +-- Lib/test/test_sqlite3/test_dbapi.py | 2 +- Lib/test/test_sqlite3/test_transactions.py | 2 +- Lib/test/test_statistics.py | 8 ++--- Lib/test/test_syntax.py | 4 +-- Lib/test/test_time.py | 2 +- .../test_tkinter/test_geometry_managers.py | 2 +- Lib/test/test_tkinter/test_widgets.py | 2 +- Lib/test/test_traceback.py | 2 +- Lib/test/test_typing.py | 2 +- Lib/test/test_unicodedata.py | 2 +- Lib/test/test_unittest/test_assertions.py | 2 +- Lib/test/test_unittest/test_case.py | 2 +- Lib/test/test_unittest/test_result.py | 2 +- Lib/test/test_unittest/testmock/support.py | 2 +- Lib/test/test_uuid.py | 4 +-- Lib/test/test_xml_etree.py | 10 +++--- Lib/tkinter/simpledialog.py | 2 +- Lib/unittest/mock.py | 4 +-- Lib/wsgiref/validate.py | 2 +- Misc/HISTORY | 14 ++++---- Misc/NEWS.d/3.10.0a2.rst | 2 +- Misc/NEWS.d/3.10.0a3.rst | 4 +-- Misc/NEWS.d/3.10.0b1.rst | 2 +- Misc/NEWS.d/3.11.0a5.rst | 2 +- Misc/NEWS.d/3.11.0a7.rst | 2 +- Misc/NEWS.d/3.12.0a1.rst | 4 +-- Misc/NEWS.d/3.12.0a4.rst | 2 +- Misc/NEWS.d/3.12.0a5.rst | 2 +- Misc/NEWS.d/3.12.0a7.rst | 2 +- Misc/NEWS.d/3.13.0a1.rst | 2 +- Misc/NEWS.d/3.13.0a3.rst | 2 +- Misc/NEWS.d/3.5.1rc1.rst | 2 +- Misc/NEWS.d/3.5.3rc1.rst | 2 +- Misc/NEWS.d/3.6.0a1.rst | 2 +- Misc/NEWS.d/3.6.0b4.rst | 2 +- Misc/NEWS.d/3.7.0a1.rst | 2 +- Misc/NEWS.d/3.8.0a3.rst | 2 +- Misc/NEWS.d/3.9.0a1.rst | 2 +- Misc/NEWS.d/3.9.0a2.rst | 2 +- Misc/NEWS.d/3.9.0a6.rst | 2 +- ...-05-08-21-30-33.gh-issue-118760.XvyMHn.rst | 2 +- Modules/_ctypes/callproc.c | 2 +- Modules/_sqlite/cursor.c | 2 +- Modules/_sre/sre.c | 2 +- Modules/_ssl_data_111.h | 6 ++-- Modules/_testcapi/exceptions.c | 2 +- Modules/_testcapi/mem.c | 2 +- Modules/_testinternalcapi.c | 2 +- Modules/_tkinter.c | 30 ++++++++--------- Modules/_xxtestfuzz/fuzzer.c | 2 +- Modules/binascii.c | 2 +- Modules/expat/xmlparse.c | 8 ++--- Modules/itertoolsmodule.c | 4 +-- Modules/posixmodule.c | 2 +- Modules/syslogmodule.c | 2 +- Objects/listsort.txt | 2 +- Objects/mimalloc/init.c | 2 +- Objects/mimalloc/prim/windows/prim.c | 2 +- PC/launcher.c | 2 +- Parser/action_helpers.c | 4 +-- Parser/pegen.c | 2 +- Parser/pegen_errors.c | 2 +- Python/_warnings.c | 2 +- Python/flowgraph.c | 2 +- Python/import.c | 2 +- Python/pystate.c | 6 ++-- Tools/build/generate_sbom.py | 2 +- Tools/c-analyzer/c_parser/match.py | 2 +- Tools/c-analyzer/c_parser/parser/__init__.py | 4 +-- Tools/freeze/README | 2 +- Tools/gdb/libpython.py | 4 +-- Tools/i18n/msgfmt.py | 2 +- Tools/jit/ignore-tests-emulated-linux.txt | 2 +- .../peg_generator/pegen/grammar_visualizer.py | 6 ++-- Tools/scripts/summarize_stats.py | 2 +- .../{supressions.txt => suppressions.txt} | 0 Tools/tsan/suppressions_free_threading.txt | 2 +- aclocal.m4 | 2 +- configure.ac | 4 +-- 142 files changed, 276 insertions(+), 276 deletions(-) rename Lib/test/test_importlib/resources/{test_compatibilty_files.py => test_compatibility_files.py} (100%) rename Tools/tsan/{supressions.txt => suppressions.txt} (100%) diff --git a/.github/problem-matchers/gcc.json b/.github/problem-matchers/gcc.json index bd5ab6c00a7608..b78324cf10e84d 100644 --- a/.github/problem-matchers/gcc.json +++ b/.github/problem-matchers/gcc.json @@ -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", diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ec7904c2e2cc73..8993361e2e62d5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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: diff --git a/Doc/c-api/init.rst b/Doc/c-api/init.rst index 8e0cf7bb0fc088..3b0fa5acf87506 100644 --- a/Doc/c-api/init.rst +++ b/Doc/c-api/init.rst @@ -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`. diff --git a/Doc/c-api/long.rst b/Doc/c-api/long.rst index 02ef8aa7846468..6f4a5037018383 100644 --- a/Doc/c-api/long.rst +++ b/Doc/c-api/long.rst @@ -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. diff --git a/Doc/c-api/monitoring.rst b/Doc/c-api/monitoring.rst index 285ddb2889a67f..51d866cfd47469 100644 --- a/Doc/c-api/monitoring.rst +++ b/Doc/c-api/monitoring.rst @@ -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. diff --git a/Doc/library/concurrent.futures.rst b/Doc/library/concurrent.futures.rst index ce72127127c7a6..141b30194b84eb 100644 --- a/Doc/library/concurrent.futures.rst +++ b/Doc/library/concurrent.futures.rst @@ -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): diff --git a/Doc/library/importlib.metadata.rst b/Doc/library/importlib.metadata.rst index 85d5a2d684d6eb..ddfc5c06d825c0 100644 --- a/Doc/library/importlib.metadata.rst +++ b/Doc/library/importlib.metadata.rst @@ -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 diff --git a/Doc/using/windows.rst b/Doc/using/windows.rst index 20d872d7639219..daaf8822af1161 100644 --- a/Doc/using/windows.rst +++ b/Doc/using/windows.rst @@ -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``). diff --git a/Include/cpython/critical_section.h b/Include/cpython/critical_section.h index 35db3fb6a59ce6..4d48ba13451304 100644 --- a/Include/cpython/critical_section.h +++ b/Include/cpython/critical_section.h @@ -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). @@ -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; diff --git a/Include/internal/pycore_code.h b/Include/internal/pycore_code.h index 57e0a14bb9b5bd..ad85463e9d90a8 100644 --- a/Include/internal/pycore_code.h +++ b/Include/internal/pycore_code.h @@ -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 */ diff --git a/Include/internal/pycore_critical_section.h b/Include/internal/pycore_critical_section.h index 78cd0d54972660..98d5afc28c79b6 100644 --- a/Include/internal/pycore_critical_section.h +++ b/Include/internal/pycore_critical_section.h @@ -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) \ diff --git a/Include/internal/pycore_hamt.h b/Include/internal/pycore_hamt.h index d8742c7cb63578..251ca987992135 100644 --- a/Include/internal/pycore_hamt.h +++ b/Include/internal/pycore_hamt.h @@ -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 diff --git a/Include/internal/pycore_lock.h b/Include/internal/pycore_lock.h index 57cbce8f126aca..f2c90973126419 100644 --- a/Include/internal/pycore_lock.h +++ b/Include/internal/pycore_lock.h @@ -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; diff --git a/Include/internal/pycore_object.h b/Include/internal/pycore_object.h index 8832692d03c29e..ec4ca18f76d52a 100644 --- a/Include/internal/pycore_object.h +++ b/Include/internal/pycore_object.h @@ -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 diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h index 2ce3a008b7129e..2eca4c1def35f9 100644 --- a/Include/unicodeobject.h +++ b/Include/unicodeobject.h @@ -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. */ diff --git a/InternalDocs/adaptive.md b/InternalDocs/adaptive.md index 09245730b271fa..6cb560eeb9dc1c 100644 --- a/InternalDocs/adaptive.md +++ b/InternalDocs/adaptive.md @@ -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 diff --git a/Lib/_pyio.py b/Lib/_pyio.py index 7b6d10c008d3cb..c3e0580ba2d3c0 100644 --- a/Lib/_pyio.py +++ b/Lib/_pyio.py @@ -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() diff --git a/Lib/_pyrepl/unix_console.py b/Lib/_pyrepl/unix_console.py index 2576b938a34c64..1b2b69cb52d42d 100644 --- a/Lib/_pyrepl/unix_console.py +++ b/Lib/_pyrepl/unix_console.py @@ -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) diff --git a/Lib/bdb.py b/Lib/bdb.py index 666f9714eb9b7a..2bdf043e47b453 100644 --- a/Lib/bdb.py +++ b/Lib/bdb.py @@ -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. diff --git a/Lib/difflib.py b/Lib/difflib.py index 7f595b6c72e641..85d52fcc4e9018 100644 --- a/Lib/difflib.py +++ b/Lib/difflib.py @@ -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), diff --git a/Lib/email/_header_value_parser.py b/Lib/email/_header_value_parser.py index ec2215a5e5f33c..a42d08f1d4daeb 100644 --- a/Lib/email/_header_value_parser.py +++ b/Lib/email/_header_value_parser.py @@ -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. diff --git a/Lib/idlelib/help.html b/Lib/idlelib/help.html index 827d230b54e159..d20a76ca645453 100644 --- a/Lib/idlelib/help.html +++ b/Lib/idlelib/help.html @@ -554,7 +554,7 @@

Key bindingsControl key on Windows and -Unix and the Command key on macOS. (And all such dicussions +Unix and the Command key on macOS. (And all such discussions assume that the keys have not been re-bound to something else.)