Skip to content

Commit 9e108b8

Browse files
Wulian233picnixz
andauthored
Fix typos in docs, error messages and comments (#123336)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
1 parent 4c6dca8 commit 9e108b8

21 files changed

+25
-25
lines changed

Doc/c-api/init.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ Initializing and finalizing the interpreter
426426
loaded extension modules loaded by Python are not unloaded. Small amounts of
427427
memory allocated by the Python interpreter may not be freed (if you find a leak,
428428
please report it). Memory tied up in circular references between objects is not
429-
freed. Interned strings will all be deallocated regarldess of their reference count.
429+
freed. Interned strings will all be deallocated regardless of their reference count.
430430
Some memory allocated by extension modules may not be freed. Some extensions may not
431431
work properly if their initialization routine is called more than once; this can
432432
happen if an application calls :c:func:`Py_Initialize` and :c:func:`Py_FinalizeEx`

Misc/NEWS.d/3.10.0b1.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ cause any runtime effects with ``from __future__ import annotations``.
277277
.. section: Core and Builtins
278278
279279
:exc:`SyntaxError` exceptions raised by the interpreter will highlight the
280-
full error range of the expression that consistutes the syntax error itself,
280+
full error range of the expression that constitutes the syntax error itself,
281281
instead of just where the problem is detected. Patch by Pablo Galindo.
282282

283283
..

Misc/NEWS.d/3.12.0a3.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ returns an invalid file descriptor.
221221
222222
Also \ escape \s in the http.server BaseHTTPRequestHandler.log_message so
223223
that it is technically possible to parse the line and reconstruct what the
224-
original data was. Without this a \xHH is ambiguious as to if it is a hex
224+
original data was. Without this a \xHH is ambiguous as to if it is a hex
225225
replacement we put in or the characters r"\x" came through in the original
226226
request line.
227227

Misc/NEWS.d/3.12.0a5.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ a positional argument would lead to a :exc:`TypeError`.
287287
.. section: Library
288288
289289
Group-related variables of ``_posixsubprocess`` module are renamed to stress
290-
that supplimentary group affinity is added to a fork, not replace the
290+
that supplementary group affinity is added to a fork, not replace the
291291
inherited ones. Patch by Oleg Iarygin.
292292

293293
..

Misc/NEWS.d/3.7.0b1.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ callback.
414414
.. section: Library
415415
416416
Fix memory leak in asyncio.Queue, when the queue has limited size and it is
417-
full, the cancelation of queue.put() can cause a memory leak. Patch by: José
417+
full, the cancellation of queue.put() can cause a memory leak. Patch by: José
418418
Melero.
419419

420420
..

Misc/stable_abi.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
# - struct_abi_kind: for `struct`, defines how much of the struct is exposed:
4141
# - 'full-abi': All of the struct is part of the ABI, including the size
4242
# (users may define arrays of these structs).
43-
# Typically used for initalization, rather than at runtime.
43+
# Typically used for initialization, rather than at runtime.
4444
# - 'opaque': No members are part of the ABI, nor is the size. The Limited
4545
# API only handles these via pointers. The C definition should be
4646
# incomplete (opaque).

Modules/_ctypes/_ctypes_test.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,8 @@ _testfunc_array_in_struct3C_set_defaults(void)
211211
/*
212212
* Test3D struct tests the MAX_STRUCT_SIZE 64. Structs containing arrays of up
213213
* to eight floating-point types are passed in registers on PPC64LE platforms.
214-
* This struct is used for within bounds test on PPC64LE platfroms and for an
215-
* out-of-bounds tests for platfroms where MAX_STRUCT_SIZE is less than 64.
214+
* This struct is used for within bounds test on PPC64LE platforms and for an
215+
* out-of-bounds tests for platforms where MAX_STRUCT_SIZE is less than 64.
216216
* See gh-110190.
217217
*/
218218
typedef struct {

Modules/_datetimemodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1855,7 +1855,7 @@ wrap_strftime(PyObject *object, PyObject *format, PyObject *timetuple,
18551855
/* Buffer of maximum size of formatted year permitted by long. */
18561856
char buf[SIZEOF_LONG * 5 / 2 + 2
18571857
#ifdef Py_STRFTIME_C99_SUPPORT
1858-
/* Need 6 more to accomodate dashes, 2-digit month and day for %F. */
1858+
/* Need 6 more to accommodate dashes, 2-digit month and day for %F. */
18591859
+ 6
18601860
#endif
18611861
];

Modules/_io/textio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1719,7 +1719,7 @@ _io_TextIOWrapper_write_impl(textio *self, PyObject *text)
17191719
bytes_len = PyBytes_GET_SIZE(b);
17201720
}
17211721

1722-
// We should avoid concatinating huge data.
1722+
// We should avoid concatenating huge data.
17231723
// Flush the buffer before adding b to the buffer if b is not small.
17241724
// https://github.com/python/cpython/issues/87426
17251725
if (bytes_len >= self->chunk_size) {

Modules/_stat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ S_IWOTH: write by others\n\
506506
S_IXOTH: execute by others\n\
507507
\n"
508508

509-
"UF_SETTABLE: mask of owner changable flags\n\
509+
"UF_SETTABLE: mask of owner changeable flags\n\
510510
UF_NODUMP: do not dump file\n\
511511
UF_IMMUTABLE: file may not be changed\n\
512512
UF_APPEND: file may only be appended to\n\

Modules/_testcapi/run.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,14 @@ run_fileexflags(PyObject *mod, PyObject *pos_args)
7878
result = PyRun_FileExFlags(fp, filename, start, globals, locals, closeit, pflags);
7979

8080
if (closeit && result && _Py_IsValidFD(fd)) {
81-
PyErr_SetString(PyExc_AssertionError, "File was not closed after excution");
81+
PyErr_SetString(PyExc_AssertionError, "File was not closed after execution");
8282
Py_DECREF(result);
8383
fclose(fp);
8484
return NULL;
8585
}
8686

8787
if (!closeit && !_Py_IsValidFD(fd)) {
88-
PyErr_SetString(PyExc_AssertionError, "Bad file descriptor after excution");
88+
PyErr_SetString(PyExc_AssertionError, "Bad file descriptor after execution");
8989
Py_XDECREF(result);
9090
return NULL;
9191
}

Modules/posixmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9025,7 +9025,7 @@ os_getgrouplist_impl(PyObject *module, const char *user, gid_t basegid)
90259025

90269026
/*
90279027
* NGROUPS_MAX is defined by POSIX.1 as the maximum
9028-
* number of supplimental groups a users can belong to.
9028+
* number of supplemental groups a users can belong to.
90299029
* We have to increment it by one because
90309030
* getgrouplist() returns both the supplemental groups
90319031
* and the primary group, i.e. all of the groups the

Modules/selectmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -817,7 +817,7 @@ static int devpoll_flush(devpollObject *self)
817817

818818
if (n < size) {
819819
/*
820-
** Data writed to /dev/poll is a binary data structure. It is not
820+
** Data written to /dev/poll is a binary data structure. It is not
821821
** clear what to do if a partial write occurred. For now, raise
822822
** an exception and see if we actually found this problem in
823823
** the wild.

Modules/sha3module.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ _SHAKE_digest(SHA3object *self, unsigned long digestlen, int hex)
432432
}
433433

434434
/* Get the raw (binary) digest value. The HACL functions errors out if:
435-
* - the algorith is not shake -- not the case here
435+
* - the algorithm is not shake -- not the case here
436436
* - the output length is zero -- we follow the existing behavior and return
437437
* an empty digest, without raising an error */
438438
if (digestlen > 0) {

Objects/mimalloc/alloc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ static inline bool mi_check_is_double_free(const mi_page_t* page, const mi_block
237237
if (((uintptr_t)n & (MI_INTPTR_SIZE-1))==0 && // quick check: aligned pointer?
238238
(n==NULL || mi_is_in_same_page(block, n))) // quick check: in same page or NULL?
239239
{
240-
// Suspicous: decoded value a in block is in the same page (or NULL) -- maybe a double free?
240+
// Suspicious: decoded value a in block is in the same page (or NULL) -- maybe a double free?
241241
// (continue in separate function to improve code generation)
242242
is_double_free = mi_check_is_double_freex(page, block);
243243
}

Objects/mimalloc/arena.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ static mi_decl_noinline void* mi_arena_try_alloc_at(mi_arena_t* arena, size_t ar
269269
return p;
270270
}
271271

272-
// allocate in a speficic arena
272+
// allocate in a specific arena
273273
static void* mi_arena_try_alloc_at_id(mi_arena_id_t arena_id, bool match_numa_node, int numa_node, size_t size, size_t alignment,
274274
bool commit, bool allow_large, mi_arena_id_t req_arena_id, mi_memid_t* memid, mi_os_tld_t* tld )
275275
{
@@ -493,7 +493,7 @@ static bool mi_arena_purge_range(mi_arena_t* arena, size_t idx, size_t startidx,
493493
size_t bitidx = startidx;
494494
bool all_purged = false;
495495
while (bitidx < endidx) {
496-
// count consequetive ones in the purge mask
496+
// count consecutive ones in the purge mask
497497
size_t count = 0;
498498
while (bitidx + count < endidx && (purge & ((size_t)1 << (bitidx + count))) != 0) {
499499
count++;
@@ -530,7 +530,7 @@ static bool mi_arena_try_purge(mi_arena_t* arena, mi_msecs_t now, bool force, mi
530530
if (purge != 0) {
531531
size_t bitidx = 0;
532532
while (bitidx < MI_BITMAP_FIELD_BITS) {
533-
// find consequetive range of ones in the purge mask
533+
// find consecutive range of ones in the purge mask
534534
size_t bitlen = 0;
535535
while (bitidx + bitlen < MI_BITMAP_FIELD_BITS && (purge & ((size_t)1 << (bitidx + bitlen))) != 0) {
536536
bitlen++;

Objects/mimalloc/bitmap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ terms of the MIT license. A copy of the license can be found in the file
77

88
/* ----------------------------------------------------------------------------
99
Concurrent bitmap that can set/reset sequences of bits atomically,
10-
represeted as an array of fields where each field is a machine word (`size_t`)
10+
represented as an array of fields where each field is a machine word (`size_t`)
1111
1212
There are two api's; the standard one cannot have sequences that cross
1313
between the bitmap fields (and a sequence must be <= MI_BITMAP_FIELD_BITS).

Objects/mimalloc/options.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ static _Atomic(size_t) warning_count; // = 0; // when >= max_warning_count stop
269269
// (recursively) invoke malloc again to allocate space for the thread local
270270
// variables on demand. This is why we use a _mi_preloading test on such
271271
// platforms. However, C code generator may move the initial thread local address
272-
// load before the `if` and we therefore split it out in a separate funcion.
272+
// load before the `if` and we therefore split it out in a separate function.
273273
static mi_decl_thread bool recurse = false;
274274

275275
static mi_decl_noinline bool mi_recurse_enter_prim(void) {

Objects/mimalloc/page.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ void _mi_page_retire(mi_page_t* page) mi_attr_noexcept {
481481
if (index < heap->page_retired_min) heap->page_retired_min = index;
482482
if (index > heap->page_retired_max) heap->page_retired_max = index;
483483
mi_assert_internal(mi_page_all_free(page));
484-
return; // dont't free after all
484+
return; // don't free after all
485485
}
486486
}
487487
_PyMem_mi_page_maybe_free(page, pq, false);

Objects/mimalloc/prim/unix/prim.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ bool _mi_prim_getenv(const char* name, char* result, size_t result_size) {
739739
#endif
740740
bool _mi_prim_random_buf(void* buf, size_t buf_len) {
741741
#if defined(MAC_OS_X_VERSION_10_15) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_15
742-
// We prefere CCRandomGenerateBytes as it returns an error code while arc4random_buf
742+
// We prefer CCRandomGenerateBytes as it returns an error code while arc4random_buf
743743
// may fail silently on macOS. See PR #390, and <https://opensource.apple.com/source/Libc/Libc-1439.40.11/gen/FreeBSD/arc4random.c.auto.html>
744744
return (CCRandomGenerateBytes(buf, buf_len) == kCCSuccess);
745745
#else

Objects/mimalloc/segment.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ static mi_page_t* mi_segment_span_allocate(mi_segment_t* segment, size_t slice_i
718718
// set slice back pointers for the first MI_MAX_SLICE_OFFSET entries
719719
size_t extra = slice_count-1;
720720
if (extra > MI_MAX_SLICE_OFFSET) extra = MI_MAX_SLICE_OFFSET;
721-
if (slice_index + extra >= segment->slice_entries) extra = segment->slice_entries - slice_index - 1; // huge objects may have more slices than avaiable entries in the segment->slices
721+
if (slice_index + extra >= segment->slice_entries) extra = segment->slice_entries - slice_index - 1; // huge objects may have more slices than available entries in the segment->slices
722722

723723
mi_slice_t* slice_next = slice + 1;
724724
for (size_t i = 1; i <= extra; i++, slice_next++) {

0 commit comments

Comments
 (0)