Skip to content

Fix typos in >60 files using codespell & manual review to get rid of false positives #136887

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Doc/extending/extending.rst
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ and initialize it by calling :c:func:`PyErr_NewException` in the module's

SpamError = PyErr_NewException("spam.error", NULL, NULL);

Since :c:data:`!SpamError` is a global variable, it will be overwitten every time
Since :c:data:`!SpamError` is a global variable, it will be overwritten every time
the module is reinitialized, when the :c:data:`Py_mod_exec` function is called.

For now, let's avoid the issue: we will block repeated initialization by raising an
Expand Down
2 changes: 1 addition & 1 deletion Doc/library/shelve.rst
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ Restrictions
which can cause hard crashes when trying to read from the database.

* :meth:`Shelf.reorganize` may not be available for all database packages and
may temporarely increase resource usage (especially disk space) when called.
may temporarily increase resource usage (especially disk space) when called.
Additionally, it will never run automatically and instead needs to be called
explicitly.

Expand Down
2 changes: 1 addition & 1 deletion Doc/whatsnew/3.14.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1051,7 +1051,7 @@ Concurrent safe warnings control
The :class:`warnings.catch_warnings` context manager will now optionally
use a context variable for warning filters. This is enabled by setting
the :data:`~sys.flags.context_aware_warnings` flag, either with the ``-X``
command-line option or an environment variable. This gives predicable
command-line option or an environment variable. This gives predictable
warnings control when using :class:`~warnings.catch_warnings` combined with
multiple threads or asynchronous tasks. The flag defaults to true for the
free-threaded build and false for the GIL-enabled build.
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_pymem.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ extern void _PyMem_FreeDelayed(void *ptr, size_t size);
extern void _PyMem_ProcessDelayed(PyThreadState *tstate);

// Periodically process delayed free requests when the world is stopped.
// Notify of any objects whic should be freeed.
// Notify of any objects which should be freed.
typedef void (*delayed_dealloc_cb)(PyObject *, void *);
extern void _PyMem_ProcessDelayedNoDealloc(PyThreadState *tstate,
delayed_dealloc_cb cb, void *state);
Expand Down
2 changes: 1 addition & 1 deletion Include/modsupport.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ PyAPI_FUNC(int) PyModule_Add(PyObject *mod, const char *name, PyObject *value);

// Similar to PyModule_AddObjectRef() and PyModule_Add() but steal
// a reference to 'value' on success and only on success.
// Errorprone. Should not be used in new code.
// Error-prone. Should not be used in new code.
PyAPI_FUNC(int) PyModule_AddObject(PyObject *mod, const char *, PyObject *value);

PyAPI_FUNC(int) PyModule_AddIntConstant(PyObject *, const char *, long);
Expand Down
2 changes: 1 addition & 1 deletion Include/refcount.h
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ static inline Py_ALWAYS_INLINE void Py_DECREF(PyObject *op)
* There are cases where it's safe to use the naive code, but they're brittle.
* For example, if `op` points to a Python integer, you know that destroying
* one of those can't cause problems -- but in part that relies on that
* Python integers aren't currently weakly referencable. Best practice is
* Python integers aren't currently weakly referenceable. Best practice is
* to use Py_CLEAR() even if you can't think of a reason for why you need to.
*
* gh-98724: Use a temporary variable to only evaluate the macro argument once,
Expand Down
2 changes: 1 addition & 1 deletion Include/unicodeobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,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/asyncio.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ the current task is found and returned. If no matching thread state is
found, `None` is returned.

In free-threading, it avoids contention on a global dictionary as
threads can access the current task of thier running loop without any
threads can access the current task of their running loop without any
locking.

---
Expand Down
2 changes: 1 addition & 1 deletion Lib/imaplib.py
Original file line number Diff line number Diff line change
Expand Up @@ -1524,7 +1524,7 @@ def _pop(self, timeout, default=('', None)):
# Historical Note:
# The timeout was originally implemented using select() after
# checking for the presence of already-buffered data.
# That allowed timeouts on pipe connetions like IMAP4_stream.
# That allowed timeouts on pipe connections like IMAP4_stream.
# However, it seemed possible that SSL data arriving without any
# IMAP data afterward could cause select() to indicate available
# application data when there was none, leading to a read() call
Expand Down
2 changes: 1 addition & 1 deletion Lib/multiprocessing/resource_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def _reentrant_call_error(self):
"Reentrant call into the multiprocessing resource tracker")

def __del__(self):
# making sure child processess are cleaned before ResourceTracker
# making sure child processes are cleaned before ResourceTracker
# gets destructed.
# see https://github.com/python/cpython/issues/88887
self._stop(use_blocking_lock=False)
Expand Down
2 changes: 1 addition & 1 deletion Lib/sysconfig/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ def _get_sysconfigdata():


def _installation_is_relocated():
"""Is the Python installation running from a different prefix than what was targetted when building?"""
"""Is the Python installation running from a different prefix than what was targeted when building?"""
if os.name != 'posix':
raise NotImplementedError('sysconfig._installation_is_relocated() is currently only supported on POSIX')

Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_asyncio/test_sslproto.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def test_connection_lost_when_busy(self):
sock.fileno = mock.Mock(return_value=12345)
sock.send = mock.Mock(side_effect=BrokenPipeError)

# construct StreamWriter chain that contains loop dependant logic this emulates
# construct StreamWriter chain that contains loop dependent logic this emulates
# what _make_ssl_transport() does in BaseSelectorEventLoop
reader = asyncio.StreamReader(limit=2 ** 16, loop=self.loop)
protocol = asyncio.StreamReaderProtocol(reader, loop=self.loop)
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -4456,7 +4456,7 @@ def test_pybuffer_size_from_format(self):

@support.cpython_only
def test_flags_overflow(self):
# gh-126594: Check for integer overlow on large flags
# gh-126594: Check for integer overflow on large flags
try:
from _testcapi import INT_MIN, INT_MAX
except ImportError:
Expand Down
4 changes: 2 additions & 2 deletions Lib/test/test_build_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
class FormatTestsBase:
@property
def contents(self):
"""Install details file contents. Should be overriden by subclasses."""
"""Install details file contents. Should be overridden by subclasses."""
raise NotImplementedError

@property
Expand Down Expand Up @@ -114,7 +114,7 @@ def contents(self):
def test_location(self):
self.assertTrue(os.path.isfile(self.location))

# Override generic format tests with tests for our specific implemenation.
# Override generic format tests with tests for our specific implementation.

@needs_installed_python
@unittest.skipIf(
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_capi/test_tuple.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def test__tuple_resize(self):
def test_bug_59313(self):
# Before 3.14, the C-API function PySequence_Tuple
# would create incomplete tuples which were visible to
# the cycle GC, and this test would crash the interpeter.
# the cycle GC, and this test would crash the interpreter.
TAG = object()
tuples = []

Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_capi/test_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ class FreezeThis(metaclass=Meta):
self.assertEqual(FreezeThis.value, 2)

def test_manual_heap_type(self):
# gh-128923: test that a manually allocated and initailized heap type
# gh-128923: test that a manually allocated and initialized heap type
# works correctly
ManualHeapType = _testcapi.ManualHeapType
for i in range(100):
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_cmd_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -980,7 +980,7 @@ def test_python_legacy_windows_fs_encoding(self):
def test_python_legacy_windows_stdio(self):
# Test that _WindowsConsoleIO is used when PYTHONLEGACYWINDOWSSTDIO
# is not set.
# We cannot use PIPE becase it prevents creating new console.
# We cannot use PIPE because it prevents creating new console.
# So we use exit code.
code = "import sys; sys.exit(type(sys.stdout.buffer.raw).__name__ != '_WindowsConsoleIO')"
env = os.environ.copy()
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -1581,7 +1581,7 @@ def check_unhashable_key():
with check_unhashable_key():
d.get(key)

# Only TypeError exception is overriden,
# Only TypeError exception is overridden,
# other exceptions are left unchanged.
class HashError:
def __hash__(self):
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_dis.py
Original file line number Diff line number Diff line change
Expand Up @@ -1696,7 +1696,7 @@ def jumpy():
# code_object_inner before rerunning the tests

def _stringify_instruction(instr):
# Since postions offsets change a lot for these test cases, ignore them.
# Since positions offsets change a lot for these test cases, ignore them.
base = (
f" make_inst(opname={instr.opname!r}, arg={instr.arg!r}, argval={instr.argval!r}, " +
f"argrepr={instr.argrepr!r}, offset={instr.offset}, start_offset={instr.start_offset}, " +
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_fileio.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ def check_readall(name, code, prelude="", cleanup="",
syscalls = strace_helper.filter_memory(syscalls)

# The first call should be an open that returns a
# file descriptor (fd). Afer that calls may vary. Once the file
# file descriptor (fd). After that calls may vary. Once the file
# is opened, check calls refer to it by fd as the filename
# could be removed from the filesystem, renamed, etc. See:
# Time-of-check time-of-use (TOCTOU) software bug class.
Expand Down
4 changes: 2 additions & 2 deletions Lib/test/test_generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -2377,7 +2377,7 @@ def printsolution(self, x):
"""

weakref_tests = """\
Generators are weakly referencable:
Generators are weakly referenceable:

>>> import weakref
>>> def gen():
Expand All @@ -2388,7 +2388,7 @@ def printsolution(self, x):
True
>>> p = weakref.proxy(gen)

Generator-iterators are weakly referencable as well:
Generator-iterators are weakly referenceable as well:

>>> gi = gen()
>>> wr = weakref.ref(gi)
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_genexps.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@
>>> me.gi_running
0

Verify that genexps are weakly referencable
Verify that genexps are weakly referenceable

>>> import weakref
>>> g = (i*i for i in range(4))
Expand Down
4 changes: 2 additions & 2 deletions Lib/test/test_gzip.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def test_read1(self):
self.assertEqual(b''.join(blocks), data1 * 50)

def test_readinto(self):
# 10MB of uncompressible data to ensure multiple reads
# 10MB of incompressible data to ensure multiple reads
large_data = os.urandom(10 * 2**20)
with gzip.GzipFile(self.filename, 'wb') as f:
f.write(large_data)
Expand All @@ -156,7 +156,7 @@ def test_readinto(self):
self.assertEqual(buf, large_data)

def test_readinto1(self):
# 10MB of uncompressible data to ensure multiple reads
# 10MB of incompressible data to ensure multiple reads
large_data = os.urandom(10 * 2**20)
with gzip.GzipFile(self.filename, 'wb') as f:
f.write(large_data)
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -2387,7 +2387,7 @@ def __getattr__(self, attribute):
return getattr(queue, attribute)

class CustomQueueFakeProtocol(CustomQueueProtocol):
# An object implementing the minimial Queue API for
# An object implementing the minimal Queue API for
# the logging module but with incorrect signatures.
#
# The object will be considered a valid queue class since we
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_memoryview.py
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,7 @@ def test_picklebuffer_reference_loop(self):
@support.requires_resource("cpu")
class RacingTest(unittest.TestCase):
def test_racing_getbuf_and_releasebuf(self):
"""Repeatly access the memoryview for racing."""
"""Repeatedly access the memoryview for racing."""
try:
from multiprocessing.managers import SharedMemoryManager
except ImportError:
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_opcache.py
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ def test(default=None):
def make_deferred_ref_count_obj():
"""Create an object that uses deferred reference counting.

Only objects that use deferred refence counting may be stored in inline
Only objects that use deferred reference counting may be stored in inline
caches in free-threaded builds. This constructs a new class named Foo,
which uses deferred reference counting.
"""
Expand Down
6 changes: 3 additions & 3 deletions Lib/test/test_plistlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,7 @@ def test_load_aware_datetime(self):
self.assertEqual(dt.tzinfo, datetime.UTC)

@unittest.skipUnless("America/Los_Angeles" in zoneinfo.available_timezones(),
"Can't find timezone datebase")
"Can't find timezone database")
def test_dump_aware_datetime(self):
dt = datetime.datetime(2345, 6, 7, 8, 9, 10,
tzinfo=zoneinfo.ZoneInfo("America/Los_Angeles"))
Expand All @@ -877,7 +877,7 @@ def test_dump_utc_aware_datetime(self):
self.assertEqual(loaded_dt, dt)

@unittest.skipUnless("America/Los_Angeles" in zoneinfo.available_timezones(),
"Can't find timezone datebase")
"Can't find timezone database")
def test_dump_aware_datetime_without_aware_datetime_option(self):
dt = datetime.datetime(2345, 6, 7, 8,
tzinfo=zoneinfo.ZoneInfo("America/Los_Angeles"))
Expand Down Expand Up @@ -1032,7 +1032,7 @@ def test_load_aware_datetime(self):
datetime.datetime(2345, 6, 7, 8, tzinfo=datetime.UTC))

@unittest.skipUnless("America/Los_Angeles" in zoneinfo.available_timezones(),
"Can't find timezone datebase")
"Can't find timezone database")
def test_dump_aware_datetime_without_aware_datetime_option(self):
dt = datetime.datetime(2345, 6, 7, 8,
tzinfo=zoneinfo.ZoneInfo("America/Los_Angeles"))
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_pty.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def normalize_output(data):
# etc.)

# This is about the best we can do without getting some feedback
# from someone more knowledgable.
# from someone more knowledgeable.

# OSF/1 (Tru64) apparently turns \n into \r\r\n.
if data.endswith(b'\r\r\n'):
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_pyrepl/test_pyrepl.py
Original file line number Diff line number Diff line change
Expand Up @@ -1005,7 +1005,7 @@ def test_builtin_completion_top_level(self):
# Make iter_modules() search only the standard library.
# This makes the test more reliable in case there are
# other user packages/scripts on PYTHONPATH which can
# intefere with the completions.
# interfere with the completions.
lib_path = os.path.dirname(importlib.__path__[0])
sys.path = [lib_path]

Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ def check_unhashable_element():
with check_unhashable_element():
myset.discard(elem)

# Only TypeError exception is overriden,
# Only TypeError exception is overridden,
# other exceptions are left unchanged.
class HashError:
def __hash__(self):
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -2998,7 +2998,7 @@ def test_cdf(self):
X = NormalDist(100, 15)
cdfs = [X.cdf(x) for x in range(1, 200)]
self.assertEqual(set(map(type, cdfs)), {float})
# Verify montonic
# Verify monotonic
self.assertEqual(cdfs, sorted(cdfs))
# Verify center (should be exact)
self.assertEqual(X.cdf(100), 0.50)
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_subprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -3438,7 +3438,7 @@ def test_vfork_used_when_expected(self):
# because libc tends to implement that internally using vfork. But
# that'd just be testing a libc+kernel implementation detail.

# Are intersted in the system calls:
# Are interested in the system calls:
# clone,clone2,clone3,fork,vfork,exit,exit_group
# Unfortunately using `--trace` with that list to strace fails because
# not all are supported on all platforms (ex. clone2 is ia64 only...)
Expand Down
4 changes: 2 additions & 2 deletions Lib/test/test_sysconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ def test_sysconfigdata_json(self):

# Keys dependent on uncontrollable external context
ignore_keys = {'userbase'}
# Keys dependent on Python being run outside the build directrory
# Keys dependent on Python being run outside the build directory
if sysconfig.is_python_build():
ignore_keys |= {'srcdir'}
# Keys dependent on the executable location
Expand All @@ -706,7 +706,7 @@ def test_sysconfigdata_json(self):
# Keys dependent on the environment (different inside virtual environments)
if sys.prefix != sys.base_prefix:
ignore_keys |= {'prefix', 'exec_prefix', 'base', 'platbase'}
# Keys dependent on Python being run from the prefix targetted when building (different on relocatable installs)
# Keys dependent on Python being run from the prefix targeted when building (different on relocatable installs)
if sysconfig._installation_is_relocated():
ignore_keys |= {'prefix', 'exec_prefix', 'base', 'platbase', 'installed_base', 'installed_platbase'}

Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_tarfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -4112,7 +4112,7 @@ def test_sneaky_hardlink_fallback(self):
arc.add("b/")
# Point "c" to the bottom of the tree in "a"
arc.add("c", symlink_to=os.path.join("a", "t"))
# link to non-existant location under "a"
# link to non-existent location under "a"
arc.add("c/escape", symlink_to=os.path.join("..", "..",
"link_here"))
# Move "c" to point to "b" ("c/escape" no longer exists)
Expand Down
4 changes: 2 additions & 2 deletions Lib/test/test_weakref.py
Original file line number Diff line number Diff line change
Expand Up @@ -1857,7 +1857,7 @@ def test_weak_keyed_bad_delitem(self):
self.assertRaises(KeyError, d.__delitem__, o)
self.assertRaises(KeyError, d.__getitem__, o)

# If a key isn't of a weakly referencable type, __getitem__ and
# If a key isn't of a weakly referenceable type, __getitem__ and
# __setitem__ raise TypeError. __delitem__ should too.
self.assertRaises(TypeError, d.__delitem__, 13)
self.assertRaises(TypeError, d.__getitem__, 13)
Expand Down Expand Up @@ -2260,7 +2260,7 @@ def test_names(self):
>>> class Dict(dict):
... pass
...
>>> obj = Dict(red=1, green=2, blue=3) # this object is weak referencable
>>> obj = Dict(red=1, green=2, blue=3) # this object is weak referenceable
>>> r = weakref.ref(obj)
>>> print(r() is obj)
True
Expand Down
Loading
Loading