From 401ce5965bc4218a83af7c7715aeaea05a169f63 Mon Sep 17 00:00:00 2001 From: Emil Berg Date: Wed, 16 Oct 2024 09:09:40 +0200 Subject: [PATCH] Fix documentation typos in C files That is, documentation only typos in .c and .h files. --- 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 +- Modules/_sqlite/cursor.c | 2 +- Modules/_sre/sre.c | 2 +- Modules/_testcapi/exceptions.c | 2 +- Modules/_testcapi/mem.c | 2 +- Modules/_testinternalcapi.c | 2 +- Modules/_xxtestfuzz/fuzzer.c | 2 +- Modules/binascii.c | 2 +- Modules/expat/xmlparse.c | 2 +- Modules/posixmodule.c | 2 +- Objects/mimalloc/init.c | 2 +- Objects/mimalloc/prim/windows/prim.c | 2 +- PC/launcher.c | 2 +- Parser/action_helpers.c | 2 +- Parser/pegen_errors.c | 2 +- Python/_warnings.c | 2 +- Python/flowgraph.c | 2 +- Python/import.c | 2 +- Python/pystate.c | 6 +++--- 25 files changed, 30 insertions(+), 30 deletions(-) diff --git a/Include/cpython/critical_section.h b/Include/cpython/critical_section.h index 35db3fb6a59ce66..4d48ba134513042 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 57e0a14bb9b5bdf..ad85463e9d90a87 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 78cd0d549726608..98d5afc28c79b67 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 d8742c7cb635783..251ca9879921357 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 57cbce8f126acab..f2c90973126419e 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 ad1a7d7e120519c..b08358ba0c28e4b 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 2ce3a008b7129ec..2eca4c1def35f98 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/Modules/_sqlite/cursor.c b/Modules/_sqlite/cursor.c index 0fbd408f18cf6ab..883b8a88452360d 100644 --- a/Modules/_sqlite/cursor.c +++ b/Modules/_sqlite/cursor.c @@ -318,7 +318,7 @@ _pysqlite_build_column_name(pysqlite_Cursor *self, const char *colname) /* * Returns a row from the currently active SQLite statement * - * Precondidition: + * Precondition: * - sqlite3_step() has been called before and it returned SQLITE_ROW. */ static PyObject * diff --git a/Modules/_sre/sre.c b/Modules/_sre/sre.c index 2c86f8869d8e588..262d195e9d8d399 100644 --- a/Modules/_sre/sre.c +++ b/Modules/_sre/sre.c @@ -2989,7 +2989,7 @@ pattern_richcompare(PyObject *lefto, PyObject *righto, int op) /* Compare the code and the pattern because the same pattern can produce different codes depending on the locale used to compile the pattern when the re.LOCALE flag is used. Don't compare groups, - indexgroup nor groupindex: they are derivated from the pattern. */ + indexgroup nor groupindex: they are derived from the pattern. */ cmp = (memcmp(left->code, right->code, sizeof(left->code[0]) * left->codesize) == 0); } diff --git a/Modules/_testcapi/exceptions.c b/Modules/_testcapi/exceptions.c index 316ef0e7ad7e55b..abb7b8db54523f2 100644 --- a/Modules/_testcapi/exceptions.c +++ b/Modules/_testcapi/exceptions.c @@ -361,7 +361,7 @@ _testcapi_unstable_exc_prep_reraise_star_impl(PyObject *module, /* - * Define the PyRecurdingInfinitelyError_Type + * Define the PyRecurringInfinitelyError_Type */ static PyTypeObject PyRecursingInfinitelyError_Type; diff --git a/Modules/_testcapi/mem.c b/Modules/_testcapi/mem.c index ab4ad934644c382..4eeb2bb97df9b4d 100644 --- a/Modules/_testcapi/mem.c +++ b/Modules/_testcapi/mem.c @@ -492,7 +492,7 @@ pymem_api_misuse(PyObject *self, PyObject *args) char *buffer; /* Deliberate misusage of Python allocators: - allococate with PyMem but release with PyMem_Raw. */ + allocate with PyMem but release with PyMem_Raw. */ buffer = PyMem_Malloc(16); PyMem_RawFree(buffer); diff --git a/Modules/_testinternalcapi.c b/Modules/_testinternalcapi.c index c403075fbb25014..d00fe9972839764 100644 --- a/Modules/_testinternalcapi.c +++ b/Modules/_testinternalcapi.c @@ -2029,7 +2029,7 @@ static PyObject * gh_119213_getargs_impl(PyObject *module, PyObject *spam) /*[clinic end generated code: output=d8d9c95d5b446802 input=65ef47511da80fc2]*/ { - // It must never have been called in the main interprer + // It must never have been called in the main interpreter assert(!_Py_IsMainInterpreter(PyInterpreterState_Get())); return Py_NewRef(spam); } diff --git a/Modules/_xxtestfuzz/fuzzer.c b/Modules/_xxtestfuzz/fuzzer.c index a04f1412eefda1d..d966697c5dd2aec 100644 --- a/Modules/_xxtestfuzz/fuzzer.c +++ b/Modules/_xxtestfuzz/fuzzer.c @@ -273,7 +273,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 + Be careful not to add catastrophically slow regexes here, we want to exercise the matching code without causing timeouts.*/ static const char* regex_patterns[] = { ".", "^", "abc", "abc|def", "^xxx$", "\\b", "()", "[a-zA-Z0-9]", diff --git a/Modules/binascii.c b/Modules/binascii.c index 6bb01d148b6faac..5e94f894dd1d300 100644 --- a/Modules/binascii.c +++ b/Modules/binascii.c @@ -652,7 +652,7 @@ binascii_crc_hqx_impl(PyObject *module, Py_buffer *data, unsigned int crc) order from highest-order term to lowest-order term. UARTs transmit characters in order from LSB to MSB. By storing the CRC this way, we hand it to the UART in the order low-byte to high-byte; the UART - sends each low-bit to hight-bit; and the result is transmission bit + sends each low-bit to high-bit; and the result is transmission bit by bit from highest- to lowest-order term without requiring any bit shuffling on our part. Reception works similarly. diff --git a/Modules/expat/xmlparse.c b/Modules/expat/xmlparse.c index d9285b213b38bd4..fa0608d1b8c20b8 100644 --- a/Modules/expat/xmlparse.c +++ b/Modules/expat/xmlparse.c @@ -3624,7 +3624,7 @@ storeAtts(XML_Parser parser, const ENCODING *enc, const char *attStr, * has to have passed through the hash table lookup once * already. That implies that an entry for it already * exists, so the lookup above will return a pointer to - * already allocated memory. There is no opportunaity for + * already allocated memory. There is no opportunity for * the allocator to fail, so the condition above cannot be * fulfilled. * diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index c0af78ba075e85d..5312e464e2c2808 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -5716,7 +5716,7 @@ os_nice_impl(PyObject *module, int increment) /* There are two flavours of 'nice': one that returns the new priority (as required by almost all standards out there) and the - Linux/FreeBSD one, which returns '0' on success and advices + Linux/FreeBSD one, which returns '0' on success and advises the use of getpriority() to get the new priority. If we are of the nice family that returns the new priority, we diff --git a/Objects/mimalloc/init.c b/Objects/mimalloc/init.c index 81b241063ff40fc..c0a551d3fb1c5bb 100644 --- a/Objects/mimalloc/init.c +++ b/Objects/mimalloc/init.c @@ -330,7 +330,7 @@ static bool _mi_heap_done(mi_heap_t* heap) { // free if not the main thread if (heap != &_mi_heap_main) { // the following assertion does not always hold for huge segments as those are always treated - // as abondened: one may allocate it in one thread, but deallocate in another in which case + // as abandoned: one may allocate it in one thread, but deallocate in another in which case // the count can be too large or negative. todo: perhaps not count huge segments? see issue #363 // mi_assert_internal(heap->tld->segments.count == 0 || heap->thread_id != _mi_thread_id()); mi_thread_data_free((mi_thread_data_t*)heap); diff --git a/Objects/mimalloc/prim/windows/prim.c b/Objects/mimalloc/prim/windows/prim.c index a038277ad21cb04..fa26e01fe54712a 100644 --- a/Objects/mimalloc/prim/windows/prim.c +++ b/Objects/mimalloc/prim/windows/prim.c @@ -51,7 +51,7 @@ typedef NTSTATUS (__stdcall *PNtAllocateVirtualMemoryEx)(HANDLE, PVOID*, SIZE_T* static PVirtualAlloc2 pVirtualAlloc2 = NULL; static PNtAllocateVirtualMemoryEx pNtAllocateVirtualMemoryEx = NULL; -// Similarly, GetNumaProcesorNodeEx is only supported since Windows 7 +// Similarly, GetNumaProcessorNodeEx is only supported since Windows 7 typedef struct MI_PROCESSOR_NUMBER_S { WORD Group; BYTE Number; BYTE Reserved; } MI_PROCESSOR_NUMBER; typedef VOID (__stdcall *PGetCurrentProcessorNumberEx)(MI_PROCESSOR_NUMBER* ProcNumber); diff --git a/PC/launcher.c b/PC/launcher.c index 47fafbc3bf6badf..2bbe871dd6edda9 100644 --- a/PC/launcher.c +++ b/PC/launcher.c @@ -1357,7 +1357,7 @@ maybe_handle_shebang(wchar_t ** argv, wchar_t * cmdline) /* * Found line terminator - parse the shebang. * - * Strictly, we don't need to handle UTF-16 anf UTF-32, + * Strictly, we don't need to handle UTF-16 and UTF-32, * since Python itself doesn't. * Never mind, one day it might. */ diff --git a/Parser/action_helpers.c b/Parser/action_helpers.c index cb21777f5661892..7016934c8491585 100644 --- a/Parser/action_helpers.c +++ b/Parser/action_helpers.c @@ -1671,7 +1671,7 @@ _PyPegen_concatenate_strings(Parser *p, asdl_expr_seq *strings, } } - /* Drop all empty contanst strings */ + /* Drop all empty constant strings */ if (f_string_found && PyUnicode_CheckExact(elem->v.Constant.value) && PyUnicode_GET_LENGTH(elem->v.Constant.value) == 0) { diff --git a/Parser/pegen_errors.c b/Parser/pegen_errors.c index 6146f69912bfa33..5d421ea083fb6e2 100644 --- a/Parser/pegen_errors.c +++ b/Parser/pegen_errors.c @@ -419,7 +419,7 @@ _Pypegen_set_syntax_error(Parser* p, Token* last_token) { if (p->fill == 0) { RAISE_SYNTAX_ERROR("error at start before reading any input"); } - // Parser encountered EOF (End of File) unexpectedtly + // Parser encountered EOF (End of File) unexpectedly if (last_token->type == ERRORTOKEN && p->tok->done == E_EOF) { if (p->tok->level) { raise_unclosed_parentheses_error(p); diff --git a/Python/_warnings.c b/Python/_warnings.c index 3f9e73b5376223b..1639ca052430080 100644 --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -202,7 +202,7 @@ get_warnings_attr(PyInterpreterState *interp, PyObject *attr, int try_import) { PyObject *warnings_module, *obj; - /* don't try to import after the start of the Python finallization */ + /* don't try to import after the start of the Python finalization */ if (try_import && !_Py_IsInterpreterFinalizing(interp)) { warnings_module = PyImport_Import(&_Py_ID(warnings)); if (warnings_module == NULL) { diff --git a/Python/flowgraph.c b/Python/flowgraph.c index 388862912d68266..841755af470a198 100644 --- a/Python/flowgraph.c +++ b/Python/flowgraph.c @@ -1911,7 +1911,7 @@ remove_redundant_nops_and_jumps(cfg_builder *g) The consts object should still be in list form to allow new constants to be appended. - Code trasnformations that reduce code size initially fill the gaps with + Code transformations that reduce code size initially fill the gaps with NOPs. Later those NOPs are removed. */ static int diff --git a/Python/import.c b/Python/import.c index acf849f14562b9f..fe5d5e331ea76b6 100644 --- a/Python/import.c +++ b/Python/import.c @@ -1845,7 +1845,7 @@ reload_singlephase_extension(PyThreadState *tstate, assert(res.err == NULL); assert(res.kind == _Py_ext_module_kind_SINGLEPHASE); mod = res.module; - /* Tchnically, the init function could return a different module def. + /* Technically, the init function could return a different module def. * Then we would probably need to update the global cache. * However, we don't expect anyone to change the def. */ assert(res.def == def); diff --git a/Python/pystate.c b/Python/pystate.c index e3812cba41d9c24..43dd902c9c2ec76 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -599,7 +599,7 @@ static inline int check_interpreter_whence(long); For subinterpreters we memcpy() the main interpreter in PyInterpreterState_New(), leaving it in the same mostly-initialized state. The only difference is that the interpreter has some - self-referential state that is statically initializexd to the + self-referential state that is statically initialized to the main interpreter. We fix those fields here, in addition to the other dynamically initialized fields. */ @@ -1590,7 +1590,7 @@ _PyThreadState_New(PyInterpreterState *interp, int whence) return new_threadstate(interp, whence); } -// We keep this for stable ABI compabibility. +// We keep this for stable ABI compatibility. PyAPI_FUNC(PyThreadState*) _PyThreadState_Prealloc(PyInterpreterState *interp) { @@ -2963,7 +2963,7 @@ _PyThreadState_CheckConsistency(PyThreadState *tstate) // called, the GIL does no longer exist. // // tstate can be a dangling pointer (point to freed memory): only tstate value -// is used, the pointer is not deferenced. +// is used, the pointer is not dereferenced. // // tstate must be non-NULL. int