https://github.com/python/cpython/commit/c5b242f87f31286ad38991bc3868cf4cfb…
commit: c5b242f87f31286ad38991bc3868cf4cfbf2b681
branch: master
author: Ashwin Ramaswami <aramaswamis(a)gmail.com>
committer: Miss Islington (bot) <31488909+miss-islington(a)users.noreply.github.com>
date: 2019-08-31T08:25:35-07:00
summary:
bpo-37764: Fix infinite loop when parsing unstructured email headers. (GH-15239)
Fixes a case in which email._header_value_parser.get_unstructured hangs the system for some invalid headers. This covers the cases in which the header contains either:
- a case without trailing whitespace
- an invalid encoded word
https://bugs.python.org/issue37764
This fix should also be backported to 3.7 and 3.8
https://bugs.python.org/issue37764
files:
A Misc/NEWS.d/next/Security/2019-08-27-01-13-05.bpo-37764.qv67PQ.rst
M Lib/email/_header_value_parser.py
M Lib/test/test_email/test__header_value_parser.py
M Lib/test/test_email/test_email.py
M Misc/ACKS
diff --git a/Lib/email/_header_value_parser.py b/Lib/email/_header_value_parser.py
index b5003943ab0d..16c19907d68d 100644
--- a/Lib/email/_header_value_parser.py
+++ b/Lib/email/_header_value_parser.py
@@ -935,6 +935,10 @@ def __str__(self):
return ''
+class _InvalidEwError(errors.HeaderParseError):
+ """Invalid encoded word found while parsing headers."""
+
+
# XXX these need to become classes and used as instances so
# that a program can't change them in a parse tree and screw
# up other parse trees. Maybe should have tests for that, too.
@@ -1039,7 +1043,10 @@ def get_encoded_word(value):
raise errors.HeaderParseError(
"expected encoded word but found {}".format(value))
remstr = ''.join(remainder)
- if len(remstr) > 1 and remstr[0] in hexdigits and remstr[1] in hexdigits:
+ if (len(remstr) > 1 and
+ remstr[0] in hexdigits and
+ remstr[1] in hexdigits and
+ tok.count('?') < 2):
# The ? after the CTE was followed by an encoded word escape (=XX).
rest, *remainder = remstr.split('?=', 1)
tok = tok + '?=' + rest
@@ -1051,7 +1058,7 @@ def get_encoded_word(value):
try:
text, charset, lang, defects = _ew.decode('=?' + tok + '?=')
except ValueError:
- raise errors.HeaderParseError(
+ raise _InvalidEwError(
"encoded word format invalid: '{}'".format(ew.cte))
ew.charset = charset
ew.lang = lang
@@ -1101,9 +1108,12 @@ def get_unstructured(value):
token, value = get_fws(value)
unstructured.append(token)
continue
+ valid_ew = True
if value.startswith('=?'):
try:
token, value = get_encoded_word(value)
+ except _InvalidEwError:
+ valid_ew = False
except errors.HeaderParseError:
# XXX: Need to figure out how to register defects when
# appropriate here.
@@ -1125,7 +1135,10 @@ def get_unstructured(value):
# Split in the middle of an atom if there is a rfc2047 encoded word
# which does not have WSP on both sides. The defect will be registered
# the next time through the loop.
- if rfc2047_matcher.search(tok):
+ # This needs to only be performed when the encoded word is valid;
+ # otherwise, performing it on an invalid encoded word can cause
+ # the parser to go in an infinite loop.
+ if valid_ew and rfc2047_matcher.search(tok):
tok, *remainder = value.partition('=?')
vtext = ValueTerminal(tok, 'vtext')
_validate_xtext(vtext)
diff --git a/Lib/test/test_email/test__header_value_parser.py b/Lib/test/test_email/test__header_value_parser.py
index b3e6b2661524..058d902459b6 100644
--- a/Lib/test/test_email/test__header_value_parser.py
+++ b/Lib/test/test_email/test__header_value_parser.py
@@ -383,6 +383,22 @@ def test_get_unstructured_ew_without_trailing_whitespace(self):
[errors.InvalidHeaderDefect],
'')
+ def test_get_unstructured_without_trailing_whitespace_hang_case(self):
+ self._test_get_x(self._get_unst,
+ '=?utf-8?q?somevalue?=aa',
+ 'somevalueaa',
+ 'somevalueaa',
+ [errors.InvalidHeaderDefect],
+ '')
+
+ def test_get_unstructured_invalid_ew(self):
+ self._test_get_x(self._get_unst,
+ '=?utf-8?q?=somevalue?=',
+ '=?utf-8?q?=somevalue?=',
+ '=?utf-8?q?=somevalue?=',
+ [],
+ '')
+
# get_qp_ctext
def test_get_qp_ctext_only(self):
diff --git a/Lib/test/test_email/test_email.py b/Lib/test/test_email/test_email.py
index ae9625845646..8ec39190ea8d 100644
--- a/Lib/test/test_email/test_email.py
+++ b/Lib/test/test_email/test_email.py
@@ -5381,6 +5381,27 @@ def test_rfc2231_unencoded_then_encoded_segments(self):
eq(language, 'en-us')
eq(s, 'My Document For You')
+ def test_should_not_hang_on_invalid_ew_messages(self):
+ messages = ["""From: user(a)host.com
+To: user(a)host.com
+Bad-Header:
+ =?us-ascii?Q?LCSwrV11+IB0rSbSker+M9vWR7wEDSuGqmHD89Gt=ea0nJFSaiz4vX3XMJPT4vrE?=
+ =?us-ascii?Q?xGUZeOnp0o22pLBB7CYLH74Js=wOlK6Tfru2U47qR?=
+ =?us-ascii?Q?72OfyEY2p2=2FrA9xNFyvH+fBTCmazxwzF8nGkK6D?=
+
+Hello!
+""", """From: ����� �������� <xxx@xxx>
+To: "xxx" <xxx@xxx>
+Subject: ��� ���������� ����� ����� � ��������� �� ����
+MIME-Version: 1.0
+Content-Type: text/plain; charset="windows-1251";
+Content-Transfer-Encoding: 8bit
+
+�� ����� � ���� ������ ��� ��������
+"""]
+ for m in messages:
+ with self.subTest(m=m):
+ msg = email.message_from_string(m)
# Tests to ensure that signed parts of an email are completely preserved, as
diff --git a/Misc/ACKS b/Misc/ACKS
index e9ae0ed56b0d..ce8b144900eb 100644
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -1336,6 +1336,7 @@ Burton Radons
Abhilash Raj
Shorya Raj
Dhushyanth Ramasamy
+Ashwin Ramaswami
Jeff Ramnani
Bayard Randel
Varpu Rantala
diff --git a/Misc/NEWS.d/next/Security/2019-08-27-01-13-05.bpo-37764.qv67PQ.rst b/Misc/NEWS.d/next/Security/2019-08-27-01-13-05.bpo-37764.qv67PQ.rst
new file mode 100644
index 000000000000..27fa8e192f0c
--- /dev/null
+++ b/Misc/NEWS.d/next/Security/2019-08-27-01-13-05.bpo-37764.qv67PQ.rst
@@ -0,0 +1 @@
+Fixes email._header_value_parser.get_unstructured going into an infinite loop for a specific case in which the email header does not have trailing whitespace, and the case in which it contains an invalid encoded word. Patch by Ashwin Ramaswami.
\ No newline at end of file
https://github.com/python/cpython/commit/6922b9e4fce635339cb94c2fdef6bba4e2…
commit: 6922b9e4fce635339cb94c2fdef6bba4e2a99621
branch: 3.8
author: Miss Islington (bot) <31488909+miss-islington(a)users.noreply.github.com>
committer: Raymond Hettinger <rhettinger(a)users.noreply.github.com>
date: 2019-08-30T23:02:15-07:00
summary:
bpo-37977: Warn more strongly and clearly about pickle security (GH-15595) (GH-15629)
(cherry picked from commit daa82d019c52e95c3c57275307918078c1c0ac81)
Co-authored-by: Daniel Pope <lordmauve(a)users.noreply.github.com>
files:
A Misc/NEWS.d/next/Documentation/2019-08-29-14-38-01.bpo-37977.pML-UI.rst
M Doc/library/pickle.rst
diff --git a/Doc/library/pickle.rst b/Doc/library/pickle.rst
index e6025aeaf476..9442efa2b667 100644
--- a/Doc/library/pickle.rst
+++ b/Doc/library/pickle.rst
@@ -30,9 +30,17 @@ avoid confusion, the terms used here are "pickling" and "unpickling".
.. warning::
- The :mod:`pickle` module is not secure against erroneous or maliciously
- constructed data. Never unpickle data received from an untrusted or
- unauthenticated source.
+ The ``pickle`` module **is not secure**. Only unpickle data you trust.
+
+ It is possible to construct malicious pickle data which will **execute
+ arbitrary code during unpickling**. Never unpickle data that could have come
+ from an untrusted source, or that could have been tampered with.
+
+ Consider signing data with :mod:`hmac` if you need to ensure that it has not
+ been tampered with.
+
+ Safer serialization formats such as :mod:`json` may be more appropriate if
+ you are processing untrusted data. See :ref:`comparison-with-json`.
Relationship to other Python modules
@@ -75,6 +83,9 @@ The :mod:`pickle` module differs from :mod:`marshal` in several significant ways
pickling and unpickling code deals with Python 2 to Python 3 type differences
if your data is crossing that unique breaking change language boundary.
+
+.. _comparison-with-json:
+
Comparison with ``json``
^^^^^^^^^^^^^^^^^^^^^^^^
@@ -94,7 +105,10 @@ There are fundamental differences between the pickle protocols and
types, and no custom classes; pickle can represent an extremely large
number of Python types (many of them automatically, by clever usage
of Python's introspection facilities; complex cases can be tackled by
- implementing :ref:`specific object APIs <pickle-inst>`).
+ implementing :ref:`specific object APIs <pickle-inst>`);
+
+* Unlike pickle, deserializing untrusted JSON does not in itself create an
+ arbitrary code execution vulnerability.
.. seealso::
The :mod:`json` module: a standard library module allowing JSON
diff --git a/Misc/NEWS.d/next/Documentation/2019-08-29-14-38-01.bpo-37977.pML-UI.rst b/Misc/NEWS.d/next/Documentation/2019-08-29-14-38-01.bpo-37977.pML-UI.rst
new file mode 100644
index 000000000000..cd0fa3c0584a
--- /dev/null
+++ b/Misc/NEWS.d/next/Documentation/2019-08-29-14-38-01.bpo-37977.pML-UI.rst
@@ -0,0 +1 @@
+Warn more strongly and clearly about pickle insecurity
https://github.com/python/cpython/commit/daa82d019c52e95c3c57275307918078c1…
commit: daa82d019c52e95c3c57275307918078c1c0ac81
branch: master
author: Daniel Pope <lordmauve(a)users.noreply.github.com>
committer: Raymond Hettinger <rhettinger(a)users.noreply.github.com>
date: 2019-08-30T22:51:33-07:00
summary:
bpo-37977: Warn more strongly and clearly about pickle security (GH-15595)
files:
A Misc/NEWS.d/next/Documentation/2019-08-29-14-38-01.bpo-37977.pML-UI.rst
M Doc/library/pickle.rst
diff --git a/Doc/library/pickle.rst b/Doc/library/pickle.rst
index 09c9c86abbba..eb58178e0e92 100644
--- a/Doc/library/pickle.rst
+++ b/Doc/library/pickle.rst
@@ -30,9 +30,17 @@ avoid confusion, the terms used here are "pickling" and "unpickling".
.. warning::
- The :mod:`pickle` module is not secure against erroneous or maliciously
- constructed data. Never unpickle data received from an untrusted or
- unauthenticated source.
+ The ``pickle`` module **is not secure**. Only unpickle data you trust.
+
+ It is possible to construct malicious pickle data which will **execute
+ arbitrary code during unpickling**. Never unpickle data that could have come
+ from an untrusted source, or that could have been tampered with.
+
+ Consider signing data with :mod:`hmac` if you need to ensure that it has not
+ been tampered with.
+
+ Safer serialization formats such as :mod:`json` may be more appropriate if
+ you are processing untrusted data. See :ref:`comparison-with-json`.
Relationship to other Python modules
@@ -75,6 +83,9 @@ The :mod:`pickle` module differs from :mod:`marshal` in several significant ways
pickling and unpickling code deals with Python 2 to Python 3 type differences
if your data is crossing that unique breaking change language boundary.
+
+.. _comparison-with-json:
+
Comparison with ``json``
^^^^^^^^^^^^^^^^^^^^^^^^
@@ -94,7 +105,10 @@ There are fundamental differences between the pickle protocols and
types, and no custom classes; pickle can represent an extremely large
number of Python types (many of them automatically, by clever usage
of Python's introspection facilities; complex cases can be tackled by
- implementing :ref:`specific object APIs <pickle-inst>`).
+ implementing :ref:`specific object APIs <pickle-inst>`);
+
+* Unlike pickle, deserializing untrusted JSON does not in itself create an
+ arbitrary code execution vulnerability.
.. seealso::
The :mod:`json` module: a standard library module allowing JSON
diff --git a/Misc/NEWS.d/next/Documentation/2019-08-29-14-38-01.bpo-37977.pML-UI.rst b/Misc/NEWS.d/next/Documentation/2019-08-29-14-38-01.bpo-37977.pML-UI.rst
new file mode 100644
index 000000000000..cd0fa3c0584a
--- /dev/null
+++ b/Misc/NEWS.d/next/Documentation/2019-08-29-14-38-01.bpo-37977.pML-UI.rst
@@ -0,0 +1 @@
+Warn more strongly and clearly about pickle insecurity
https://github.com/python/cpython/commit/d765d81b8fb5ab707bfe8b079348e5038c…
commit: d765d81b8fb5ab707bfe8b079348e5038c298aa3
branch: master
author: Inada Naoki <songofacandy(a)gmail.com>
committer: GitHub <noreply(a)github.com>
date: 2019-08-31T08:48:12+09:00
summary:
bpo-37781: use "z" for PY_FORMAT_SIZE_T (GH-15156)
MSVC 2015 supports %zd / %zu. "z" is portable enough nowadays.
files:
M Include/pyport.h
diff --git a/Include/pyport.h b/Include/pyport.h
index 32d98c59a7c1..19415001c5b0 100644
--- a/Include/pyport.h
+++ b/Include/pyport.h
@@ -133,8 +133,9 @@ typedef int Py_ssize_clean_t;
/* PY_FORMAT_SIZE_T is a platform-specific modifier for use in a printf
* format to convert an argument with the width of a size_t or Py_ssize_t.
- * C99 introduced "z" for this purpose, but not all platforms support that;
- * e.g., MS compilers use "I" instead.
+ * C99 introduced "z" for this purpose, but old MSVCs had not supported it.
+ * Since MSVC supports "z" since (at least) 2015, we can just use "z"
+ * for new code.
*
* These "high level" Python format functions interpret "z" correctly on
* all platforms (Python interprets the format string itself, and does whatever
@@ -152,19 +153,11 @@ typedef int Py_ssize_clean_t;
* Py_ssize_t index;
* fprintf(stderr, "index %" PY_FORMAT_SIZE_T "d sucks\n", index);
*
- * That will expand to %ld, or %Id, or to something else correct for a
- * Py_ssize_t on the platform.
+ * That will expand to %zd or to something else correct for a Py_ssize_t on
+ * the platform.
*/
#ifndef PY_FORMAT_SIZE_T
-# if SIZEOF_SIZE_T == SIZEOF_INT && !defined(__APPLE__)
-# define PY_FORMAT_SIZE_T ""
-# elif SIZEOF_SIZE_T == SIZEOF_LONG
-# define PY_FORMAT_SIZE_T "l"
-# elif defined(MS_WINDOWS)
-# define PY_FORMAT_SIZE_T "I"
-# else
-# error "This platform's pyconfig.h needs to define PY_FORMAT_SIZE_T"
-# endif
+# define PY_FORMAT_SIZE_T "z"
#endif
/* Py_LOCAL can be used instead of static to get the fastest possible calling
https://github.com/python/cpython/commit/4bd1d05ee247f200e52fab3958d875bd88…
commit: 4bd1d05ee247f200e52fab3958d875bd88073e5b
branch: 3.8
author: Miss Islington (bot) <31488909+miss-islington(a)users.noreply.github.com>
committer: GitHub <noreply(a)github.com>
date: 2019-08-30T13:42:54-07:00
summary:
Fix typos mostly in comments, docs and test names (GH-15209)
(cherry picked from commit 39d87b54715197ca9dcb6902bb43461c0ed701a2)
Co-authored-by: Min ho Kim <minho42(a)gmail.com>
files:
M Doc/c-api/init_config.rst
M Doc/library/importlib.rst
M Include/pyhash.h
M Lib/asyncio/streams.py
M Lib/bdb.py
M Lib/multiprocessing/util.py
M Lib/test/lock_tests.py
M Lib/test/test_cmd_line_script.py
M Lib/test/test_collections.py
M Lib/test/test_descr.py
M Lib/test/test_format.py
M Lib/test/test_gc.py
M Lib/test/test_hmac.py
M Lib/test/test_importlib/source/test_file_loader.py
M Lib/test/test_importlib/test_main.py
M Lib/test/test_importlib/util.py
M Lib/test/test_statistics.py
M Lib/test/test_tracemalloc.py
M Lib/test/test_warnings/__init__.py
M Lib/test/test_winreg.py
M Lib/test/test_wsgiref.py
M Lib/tkinter/filedialog.py
M Lib/unittest/test/testmock/testpatch.py
M Lib/uuid.py
M Misc/HISTORY
M Misc/NEWS.d/3.5.0a1.rst
M Misc/NEWS.d/3.5.4rc1.rst
M Misc/NEWS.d/3.6.0b1.rst
M Misc/NEWS.d/3.6.0rc1.rst
M Misc/NEWS.d/3.6.1rc1.rst
M Misc/NEWS.d/3.7.0a1.rst
M Misc/NEWS.d/3.8.0a1.rst
M Misc/NEWS.d/3.8.0a4.rst
M Misc/NEWS.d/3.8.0b1.rst
M Modules/_ctypes/callproc.c
M Modules/_ctypes/stgdict.c
M Modules/_io/bytesio.c
M Modules/_io/stringio.c
M Modules/_testcapimodule.c
M Modules/expat/loadlibrary.c
M Modules/expat/xmlparse.c
M Modules/termios.c
M Objects/listsort.txt
M Objects/typeobject.c
M Python/ast.c
M Python/pystate.c
diff --git a/Doc/c-api/init_config.rst b/Doc/c-api/init_config.rst
index 72bd8c37b435..c198df3fb1d0 100644
--- a/Doc/c-api/init_config.rst
+++ b/Doc/c-api/init_config.rst
@@ -876,7 +876,7 @@ Path Configuration
If at least one "output field" is not set, Python computes the path
configuration to fill unset fields. If
:c:member:`~PyConfig.module_search_paths_set` is equal to 0,
-:c:member:`~PyConfig.module_search_paths` is overriden and
+:c:member:`~PyConfig.module_search_paths` is overridden and
:c:member:`~PyConfig.module_search_paths_set` is set to 1.
It is possible to completely ignore the function computing the default
diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst
index 65a685022e92..cb8360caca5e 100644
--- a/Doc/library/importlib.rst
+++ b/Doc/library/importlib.rst
@@ -1379,8 +1379,8 @@ an :term:`importer`.
bytecode file. An empty string represents no optimization, so
``/foo/bar/baz.py`` with an *optimization* of ``''`` will result in a
bytecode path of ``/foo/bar/__pycache__/baz.cpython-32.pyc``. ``None`` causes
- the interpter's optimization level to be used. Any other value's string
- representation being used, so ``/foo/bar/baz.py`` with an *optimization* of
+ the interpreter's optimization level to be used. Any other value's string
+ representation is used, so ``/foo/bar/baz.py`` with an *optimization* of
``2`` will lead to the bytecode path of
``/foo/bar/__pycache__/baz.cpython-32.opt-2.pyc``. The string representation
of *optimization* can only be alphanumeric, else :exc:`ValueError` is raised.
diff --git a/Include/pyhash.h b/Include/pyhash.h
index 9cfd071ea17b..dbcc9744be35 100644
--- a/Include/pyhash.h
+++ b/Include/pyhash.h
@@ -119,7 +119,7 @@ PyAPI_FUNC(PyHash_FuncDef*) PyHash_GetFuncDef(void);
* configure script.
*
* - FNV is available on all platforms and architectures.
- * - SIPHASH24 only works on plaforms that don't require aligned memory for integers.
+ * - SIPHASH24 only works on platforms that don't require aligned memory for integers.
* - With EXTERNAL embedders can provide an alternative implementation with::
*
* PyHash_FuncDef PyHash_Func = {...};
diff --git a/Lib/asyncio/streams.py b/Lib/asyncio/streams.py
index 204eaf7394c5..1d3e487b1d93 100644
--- a/Lib/asyncio/streams.py
+++ b/Lib/asyncio/streams.py
@@ -71,7 +71,7 @@ def connect(host=None, port=None, *,
ssl_handshake_timeout=None,
happy_eyeballs_delay=None, interleave=None):
# Design note:
- # Don't use decorator approach but exilicit non-async
+ # Don't use decorator approach but explicit non-async
# function to fail fast and explicitly
# if passed arguments don't match the function signature
return _ContextManagerHelper(_connect(host, port, limit,
@@ -442,7 +442,7 @@ def connect_unix(path=None, *,
ssl_handshake_timeout=None):
"""Similar to `connect()` but works with UNIX Domain Sockets."""
# Design note:
- # Don't use decorator approach but exilicit non-async
+ # Don't use decorator approach but explicit non-async
# function to fail fast and explicitly
# if passed arguments don't match the function signature
return _ContextManagerHelper(_connect_unix(path,
diff --git a/Lib/bdb.py b/Lib/bdb.py
index 96e7d18d718d..50d9eece89ad 100644
--- a/Lib/bdb.py
+++ b/Lib/bdb.py
@@ -38,7 +38,7 @@ def canonic(self, filename):
"""Return canonical form of filename.
For real filenames, the canonical form is a case-normalized (on
- case insenstive filesystems) absolute path. 'Filenames' with
+ case insensitive filesystems) absolute path. 'Filenames' with
angle brackets, such as "<stdin>", generated in interactive
mode, are returned unchanged.
"""
diff --git a/Lib/multiprocessing/util.py b/Lib/multiprocessing/util.py
index 19380917b6f5..32b51b04373f 100644
--- a/Lib/multiprocessing/util.py
+++ b/Lib/multiprocessing/util.py
@@ -238,7 +238,7 @@ def __repr__(self):
if self._kwargs:
x += ', kwargs=' + str(self._kwargs)
if self._key[0] is not None:
- x += ', exitprority=' + str(self._key[0])
+ x += ', exitpriority=' + str(self._key[0])
return x + '>'
diff --git a/Lib/test/lock_tests.py b/Lib/test/lock_tests.py
index 23a02e0b4eb2..7b1ad8eb6de8 100644
--- a/Lib/test/lock_tests.py
+++ b/Lib/test/lock_tests.py
@@ -467,7 +467,7 @@ def _check_notify(self, cond):
# of the workers.
# Secondly, this test assumes that condition variables are not subject
# to spurious wakeups. The absence of spurious wakeups is an implementation
- # detail of Condition Cariables in current CPython, but in general, not
+ # detail of Condition Variables in current CPython, but in general, not
# a guaranteed property of condition variables as a programming
# construct. In particular, it is possible that this can no longer
# be conveniently guaranteed should their implementation ever change.
diff --git a/Lib/test/test_cmd_line_script.py b/Lib/test/test_cmd_line_script.py
index b74eeba81e04..f0bd013e5536 100644
--- a/Lib/test/test_cmd_line_script.py
+++ b/Lib/test/test_cmd_line_script.py
@@ -462,7 +462,7 @@ def test_dash_m_errors(self):
('os.path', br'loader.*cannot handle'),
('importlib', br'No module named.*'
br'is a package and cannot be directly executed'),
- ('importlib.nonexistant', br'No module named'),
+ ('importlib.nonexistent', br'No module named'),
('.unittest', br'Relative module names not supported'),
)
for name, regex in tests:
diff --git a/Lib/test/test_collections.py b/Lib/test/test_collections.py
index e532be6eeaf0..58f65f3e266c 100644
--- a/Lib/test/test_collections.py
+++ b/Lib/test/test_collections.py
@@ -1930,7 +1930,7 @@ def test_order_preservation(self):
'r', 'c', 'd', ' ', 's', 's', 'i', 'i', 'm', 'm', 'l'])
# Math operations order first by the order encountered in the left
- # operand and then by the order encounted in the right operand.
+ # operand and then by the order encountered in the right operand.
ps = 'aaabbcdddeefggghhijjjkkl'
qs = 'abbcccdeefffhkkllllmmnno'
order = {letter: i for i, letter in enumerate(dict.fromkeys(ps + qs))}
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py
index 0d0c1dd1acbe..741cb6dce285 100644
--- a/Lib/test/test_descr.py
+++ b/Lib/test/test_descr.py
@@ -3025,7 +3025,7 @@ def test_str_subclass_as_dict_key(self):
# Testing a str subclass used as dict key ..
class cistr(str):
- """Sublcass of str that computes __eq__ case-insensitively.
+ """Subclass of str that computes __eq__ case-insensitively.
Also computes a hash code of the string in canonical form.
"""
diff --git a/Lib/test/test_format.py b/Lib/test/test_format.py
index 83804cbb00ab..4559cd5623ef 100644
--- a/Lib/test/test_format.py
+++ b/Lib/test/test_format.py
@@ -48,7 +48,7 @@ def testformat(formatstr, args, output=None, limit=None, overflowok=False):
def testcommon(formatstr, args, output=None, limit=None, overflowok=False):
# if formatstr is a str, test str, bytes, and bytearray;
- # otherwise, test bytes and bytearry
+ # otherwise, test bytes and bytearray
if isinstance(formatstr, str):
testformat(formatstr, args, output, limit, overflowok)
b_format = formatstr.encode('ascii')
diff --git a/Lib/test/test_gc.py b/Lib/test/test_gc.py
index 2dab53004452..311143da91d0 100644
--- a/Lib/test/test_gc.py
+++ b/Lib/test/test_gc.py
@@ -912,7 +912,7 @@ def test_collect_generation(self):
def test_collect_garbage(self):
self.preclean()
# Each of these cause four objects to be garbage: Two
- # Uncolectables and their instance dicts.
+ # Uncollectables and their instance dicts.
Uncollectable()
Uncollectable()
C1055820(666)
diff --git a/Lib/test/test_hmac.py b/Lib/test/test_hmac.py
index 896bbe9ab798..f2eb6d716d52 100644
--- a/Lib/test/test_hmac.py
+++ b/Lib/test/test_hmac.py
@@ -445,7 +445,7 @@ def test_compare_digest(self):
a, b = bytearray(b"foobar"), bytearray(b"foobar")
self.assertTrue(hmac.compare_digest(a, b))
- # Testing bytearrays of diffeent lengths
+ # Testing bytearrays of different lengths
a, b = bytearray(b"foobar"), bytearray(b"foo")
self.assertFalse(hmac.compare_digest(a, b))
@@ -458,7 +458,7 @@ def test_compare_digest(self):
self.assertTrue(hmac.compare_digest(a, b))
self.assertTrue(hmac.compare_digest(b, a))
- # Testing byte bytearray of diffeent lengths
+ # Testing byte bytearray of different lengths
a, b = bytearray(b"foobar"), b"foo"
self.assertFalse(hmac.compare_digest(a, b))
self.assertFalse(hmac.compare_digest(b, a))
@@ -472,7 +472,7 @@ def test_compare_digest(self):
a, b = "foobar", "foobar"
self.assertTrue(hmac.compare_digest(a, b))
- # Testing str of diffeent lengths
+ # Testing str of different lengths
a, b = "foo", "foobar"
self.assertFalse(hmac.compare_digest(a, b))
diff --git a/Lib/test/test_importlib/source/test_file_loader.py b/Lib/test/test_importlib/source/test_file_loader.py
index 3ffb2aa1e60a..ab44722146e3 100644
--- a/Lib/test/test_importlib/source/test_file_loader.py
+++ b/Lib/test/test_importlib/source/test_file_loader.py
@@ -325,7 +325,7 @@ def test_unchecked_hash_based_pyc(self):
)
@util.writes_bytecode_files
- def test_overiden_unchecked_hash_based_pyc(self):
+ def test_overridden_unchecked_hash_based_pyc(self):
with util.create_modules('_temp') as mapping, \
unittest.mock.patch('_imp.check_hash_based_pycs', 'always'):
source = mapping['_temp']
diff --git a/Lib/test/test_importlib/test_main.py b/Lib/test/test_importlib/test_main.py
index bc42b83ee291..3d7da819b343 100644
--- a/Lib/test/test_importlib/test_main.py
+++ b/Lib/test/test_importlib/test_main.py
@@ -32,7 +32,7 @@ def test_new_style_classes(self):
class ImportTests(fixtures.DistInfoPkg, unittest.TestCase):
def test_import_nonexistent_module(self):
# Ensure that the MetadataPathFinder does not crash an import of a
- # non-existant module.
+ # non-existent module.
with self.assertRaises(ImportError):
importlib.import_module('does_not_exist')
diff --git a/Lib/test/test_importlib/util.py b/Lib/test/test_importlib/util.py
index 196ea1c9d4dd..e016ea49119a 100644
--- a/Lib/test/test_importlib/util.py
+++ b/Lib/test/test_importlib/util.py
@@ -443,7 +443,7 @@ def contents(self):
yield entry
name = 'testingpackage'
- # Unforunately importlib.util.module_from_spec() was not introduced until
+ # Unfortunately importlib.util.module_from_spec() was not introduced until
# Python 3.5.
module = types.ModuleType(name)
loader = Reader()
diff --git a/Lib/test/test_statistics.py b/Lib/test/test_statistics.py
index 23dd96e365a8..01b317c3281e 100644
--- a/Lib/test/test_statistics.py
+++ b/Lib/test/test_statistics.py
@@ -1810,13 +1810,13 @@ def test_bimodal_data(self):
# Test mode with bimodal data.
data = [1, 1, 2, 2, 2, 2, 3, 4, 5, 6, 6, 6, 6, 7, 8, 9, 9]
assert data.count(2) == data.count(6) == 4
- # mode() should return 2, the first encounted mode
+ # mode() should return 2, the first encountered mode
self.assertEqual(self.func(data), 2)
def test_unique_data(self):
# Test mode when data points are all unique.
data = list(range(10))
- # mode() should return 0, the first encounted mode
+ # mode() should return 0, the first encountered mode
self.assertEqual(self.func(data), 0)
def test_none_data(self):
diff --git a/Lib/test/test_tracemalloc.py b/Lib/test/test_tracemalloc.py
index c3866483b8aa..4b9bf4ed5da1 100644
--- a/Lib/test/test_tracemalloc.py
+++ b/Lib/test/test_tracemalloc.py
@@ -885,7 +885,7 @@ def check_env_var_invalid(self, nframe):
return
if b'PYTHONTRACEMALLOC: invalid number of frames' in stderr:
return
- self.fail(f"unexpeced output: {stderr!a}")
+ self.fail(f"unexpected output: {stderr!a}")
def test_env_var_invalid(self):
@@ -914,7 +914,7 @@ def check_sys_xoptions_invalid(self, nframe):
return
if b'-X tracemalloc=NFRAME: invalid number of frames' in stderr:
return
- self.fail(f"unexpeced output: {stderr!a}")
+ self.fail(f"unexpected output: {stderr!a}")
def test_sys_xoptions_invalid(self):
for nframe in INVALID_NFRAME:
diff --git a/Lib/test/test_warnings/__init__.py b/Lib/test/test_warnings/__init__.py
index 86c2f226ebcf..fc3f8f6fe7f0 100644
--- a/Lib/test/test_warnings/__init__.py
+++ b/Lib/test/test_warnings/__init__.py
@@ -714,7 +714,7 @@ def test_showwarning_not_callable(self):
self.assertRaises(TypeError, self.module.warn, "Warning!")
def test_show_warning_output(self):
- # With showarning() missing, make sure that output is okay.
+ # With showwarning() missing, make sure that output is okay.
text = 'test show_warning'
with original_warnings.catch_warnings(module=self.module):
self.module.filterwarnings("always", category=UserWarning)
diff --git a/Lib/test/test_winreg.py b/Lib/test/test_winreg.py
index dc2b46e42521..91a2bbc066b1 100644
--- a/Lib/test/test_winreg.py
+++ b/Lib/test/test_winreg.py
@@ -229,7 +229,7 @@ def test_connect_registry_to_local_machine_works(self):
h.Close()
self.assertEqual(h.handle, 0)
- def test_inexistant_remote_registry(self):
+ def test_nonexistent_remote_registry(self):
connect = lambda: ConnectRegistry("abcdefghijkl", HKEY_CURRENT_USER)
self.assertRaises(OSError, connect)
diff --git a/Lib/test/test_wsgiref.py b/Lib/test/test_wsgiref.py
index bce33291c566..6af45145a792 100644
--- a/Lib/test/test_wsgiref.py
+++ b/Lib/test/test_wsgiref.py
@@ -586,10 +586,10 @@ def testEnviron(self):
expected.update({
# X doesn't exist in os_environ
"X": "Y",
- # HOME is overriden by TestHandler
+ # HOME is overridden by TestHandler
'HOME': "/override/home",
- # overriden by setup_testing_defaults()
+ # overridden by setup_testing_defaults()
"SCRIPT_NAME": "",
"SERVER_NAME": "127.0.0.1",
diff --git a/Lib/tkinter/filedialog.py b/Lib/tkinter/filedialog.py
index d9d3436145c9..88d23476fde2 100644
--- a/Lib/tkinter/filedialog.py
+++ b/Lib/tkinter/filedialog.py
@@ -463,7 +463,7 @@ def test():
except (ImportError, AttributeError):
pass
- # dialog for openening files
+ # dialog for opening files
openfilename=askopenfilename(filetypes=[("all files", "*")])
try:
diff --git a/Lib/unittest/test/testmock/testpatch.py b/Lib/unittest/test/testmock/testpatch.py
index 27914a9d7178..0632d95e58fe 100644
--- a/Lib/unittest/test/testmock/testpatch.py
+++ b/Lib/unittest/test/testmock/testpatch.py
@@ -1651,7 +1651,7 @@ def test_patch_imports_lazily(self):
p1.stop()
self.assertEqual(squizz.squozz, 3)
- def test_patch_propogrates_exc_on_exit(self):
+ def test_patch_propagates_exc_on_exit(self):
class holder:
exc_info = None, None, None
@@ -1680,9 +1680,9 @@ def test(mock):
self.assertIs(holder.exc_info[0], RuntimeError)
self.assertIsNotNone(holder.exc_info[1],
- 'exception value not propgated')
+ 'exception value not propagated')
self.assertIsNotNone(holder.exc_info[2],
- 'exception traceback not propgated')
+ 'exception traceback not propagated')
def test_create_and_specs(self):
diff --git a/Lib/uuid.py b/Lib/uuid.py
index 7aa01bb5c355..188e16ba14e3 100644
--- a/Lib/uuid.py
+++ b/Lib/uuid.py
@@ -680,7 +680,7 @@ def _random_getnode():
return random.getrandbits(48) | (1 << 40)
-# _OS_GETTERS, when known, are targetted for a specific OS or platform.
+# _OS_GETTERS, when known, are targeted for a specific OS or platform.
# The order is by 'common practice' on the specified platform.
# Note: 'posix' and 'windows' _OS_GETTERS are prefixed by a dll/dlload() method
# which, when successful, means none of these "external" methods are called.
diff --git a/Misc/HISTORY b/Misc/HISTORY
index f4b756cf0a46..fa5a05fd40fd 100644
--- a/Misc/HISTORY
+++ b/Misc/HISTORY
@@ -1231,7 +1231,7 @@ Library
- Issue #22448: Improve canceled timer handles cleanup to prevent
unbound memory usage. Patch by Joshua Moore-Oliva.
-- Issue #23009: Make sure selectors.EpollSelecrtor.select() works when no
+- Issue #23009: Make sure selectors.EpollSelector.select() works when no
FD is registered.
IDLE
@@ -16660,7 +16660,7 @@ Core and Builtins
Exception (KeyboardInterrupt, and SystemExit) propagate instead of
ignoring them.
-- #3021 Exception reraising sematics have been significantly improved. However,
+- #3021 Exception reraising semantics have been significantly improved. However,
f_exc_type, f_exc_value, and f_exc_traceback cannot be accessed from Python
code anymore.
diff --git a/Misc/NEWS.d/3.5.0a1.rst b/Misc/NEWS.d/3.5.0a1.rst
index 62406e1aa008..376cb02ed4ba 100644
--- a/Misc/NEWS.d/3.5.0a1.rst
+++ b/Misc/NEWS.d/3.5.0a1.rst
@@ -1255,7 +1255,7 @@ Support wrapped callables in doctest. Patch by Claudiu Popa.
.. nonce: -sW7gk
.. section: Library
-Make sure selectors.EpollSelecrtor.select() works when no FD is registered.
+Make sure selectors.EpollSelector.select() works when no FD is registered.
..
diff --git a/Misc/NEWS.d/3.5.4rc1.rst b/Misc/NEWS.d/3.5.4rc1.rst
index f261ddb3a2d3..04a035a41e74 100644
--- a/Misc/NEWS.d/3.5.4rc1.rst
+++ b/Misc/NEWS.d/3.5.4rc1.rst
@@ -913,7 +913,7 @@ Fixed infinite recursion in the repr of uninitialized ctypes.CDLL instances.
Fixed race condition in C implementation of functools.lru_cache. KeyError
could be raised when cached function with full cache was simultaneously
-called from differen threads with the same uncached arguments.
+called from different threads with the same uncached arguments.
..
diff --git a/Misc/NEWS.d/3.6.0b1.rst b/Misc/NEWS.d/3.6.0b1.rst
index bd0e0a7c58d1..3fbae5c6a4b3 100644
--- a/Misc/NEWS.d/3.6.0b1.rst
+++ b/Misc/NEWS.d/3.6.0b1.rst
@@ -1148,7 +1148,7 @@ dict constraint in ForwardRef._eval_type (upstream #252)
.. nonce: hxh6_h
.. section: Library
-Make ``_normalize`` parameter to ``Fraction`` constuctor keyword-only, so
+Make ``_normalize`` parameter to ``Fraction`` constructor keyword-only, so
that ``Fraction(2, 3, 4)`` now raises ``TypeError``.
..
diff --git a/Misc/NEWS.d/3.6.0rc1.rst b/Misc/NEWS.d/3.6.0rc1.rst
index c44dec324d2f..15769f950db2 100644
--- a/Misc/NEWS.d/3.6.0rc1.rst
+++ b/Misc/NEWS.d/3.6.0rc1.rst
@@ -48,7 +48,7 @@ they still are deprecated and will be disabled in 3.7.
.. section: Library
Fix a regression introduced in warnings.catch_warnings(): call
-warnings.showwarning() if it was overriden inside the context manager.
+warnings.showwarning() if it was overridden inside the context manager.
..
diff --git a/Misc/NEWS.d/3.6.1rc1.rst b/Misc/NEWS.d/3.6.1rc1.rst
index 1f9fb13f6970..58fd1b0624b2 100644
--- a/Misc/NEWS.d/3.6.1rc1.rst
+++ b/Misc/NEWS.d/3.6.1rc1.rst
@@ -435,7 +435,7 @@ Fix an important omission by adding Deque to the typing module.
Fixed race condition in C implementation of functools.lru_cache. KeyError
could be raised when cached function with full cache was simultaneously
-called from differen threads with the same uncached arguments.
+called from different threads with the same uncached arguments.
..
diff --git a/Misc/NEWS.d/3.7.0a1.rst b/Misc/NEWS.d/3.7.0a1.rst
index f9cd59c8d4bd..8a304e8755e6 100644
--- a/Misc/NEWS.d/3.7.0a1.rst
+++ b/Misc/NEWS.d/3.7.0a1.rst
@@ -3651,7 +3651,7 @@ regular expression objects.
Fixed race condition in C implementation of functools.lru_cache. KeyError
could be raised when cached function with full cache was simultaneously
-called from differen threads with the same uncached arguments.
+called from different threads with the same uncached arguments.
..
diff --git a/Misc/NEWS.d/3.8.0a1.rst b/Misc/NEWS.d/3.8.0a1.rst
index 3d376693d380..96208c88d32b 100644
--- a/Misc/NEWS.d/3.8.0a1.rst
+++ b/Misc/NEWS.d/3.8.0a1.rst
@@ -2418,7 +2418,7 @@ over browsers in the ``BROWSER`` environment variable.
.. nonce: eSLKBE
.. section: Library
-Avoid stripping trailing whitespace in doctest fancy diff. Orignial patch by
+Avoid stripping trailing whitespace in doctest fancy diff. Original patch by
R. David Murray & Jairo Trad. Enhanced by Sanyam Khurana.
..
diff --git a/Misc/NEWS.d/3.8.0a4.rst b/Misc/NEWS.d/3.8.0a4.rst
index 80e01d97a043..995aa94a7405 100644
--- a/Misc/NEWS.d/3.8.0a4.rst
+++ b/Misc/NEWS.d/3.8.0a4.rst
@@ -1110,7 +1110,7 @@ Add ``-fmax-type-align=8`` to CFLAGS when clang compiler is detected. The
pymalloc memory allocator aligns memory on 8 bytes. On x86-64, clang expects
alignment on 16 bytes by default and so uses MOVAPS instruction which can
lead to segmentation fault. Instruct clang that Python is limited to
-alignemnt on 8 bytes to use MOVUPS instruction instead: slower but don't
+alignment on 8 bytes to use MOVUPS instruction instead: slower but don't
trigger a SIGSEGV if the memory is not aligned on 16 bytes. Sadly, the flag
must be added to ``CFLAGS`` and not just ``CFLAGS_NODIST``, since third
party C extensions can have the same issue.
diff --git a/Misc/NEWS.d/3.8.0b1.rst b/Misc/NEWS.d/3.8.0b1.rst
index 609aa338e844..84b0350134fb 100644
--- a/Misc/NEWS.d/3.8.0b1.rst
+++ b/Misc/NEWS.d/3.8.0b1.rst
@@ -1262,7 +1262,7 @@ Reinitialize logging.Handler locks in forked child processes instead of
attempting to acquire them all in the parent before forking only to be
released in the child process. The acquire/release pattern was leading to
deadlocks in code that has implemented any form of chained logging handlers
-that depend upon one another as the lock acquision order cannot be
+that depend upon one another as the lock acquisition order cannot be
guaranteed.
..
diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c
index 67665246414e..1de86e48d719 100644
--- a/Modules/_ctypes/callproc.c
+++ b/Modules/_ctypes/callproc.c
@@ -110,7 +110,7 @@ static void pymem_destructor(PyObject *ptr)
WinDLL(..., use_last_error=True) swap the system LastError value with the
ctypes private copy.
- The values are also swapped immeditately before and after ctypes callback
+ The values are also swapped immediately before and after ctypes callback
functions are called, if the callbacks are constructed using the new
optional use_errno parameter set to True: CFUNCTYPE(..., use_errno=TRUE) or
WINFUNCTYPE(..., use_errno=True).
diff --git a/Modules/_ctypes/stgdict.c b/Modules/_ctypes/stgdict.c
index 235a4d79ad2c..8709cc5404a2 100644
--- a/Modules/_ctypes/stgdict.c
+++ b/Modules/_ctypes/stgdict.c
@@ -352,7 +352,7 @@ PyCStructUnionType_update_stgdict(PyObject *type, PyObject *fields, int isStruct
int big_endian;
/* HACK Alert: I cannot be bothered to fix ctypes.com, so there has to
- be a way to use the old, broken sematics: _fields_ are not extended
+ be a way to use the old, broken semantics: _fields_ are not extended
but replaced in subclasses.
XXX Remove this in ctypes 1.0!
diff --git a/Modules/_io/bytesio.c b/Modules/_io/bytesio.c
index 19e1ed8441e3..3cf6402e75f7 100644
--- a/Modules/_io/bytesio.c
+++ b/Modules/_io/bytesio.c
@@ -818,7 +818,7 @@ bytesio_setstate(bytesio *self, PyObject *state)
/* Set carefully the position value. Alternatively, we could use the seek
method instead of modifying self->pos directly to better protect the
- object internal state against errneous (or malicious) inputs. */
+ object internal state against erroneous (or malicious) inputs. */
position_obj = PyTuple_GET_ITEM(state, 1);
if (!PyLong_Check(position_obj)) {
PyErr_Format(PyExc_TypeError,
diff --git a/Modules/_io/stringio.c b/Modules/_io/stringio.c
index 9e9724db2d33..8b5fa7a369f3 100644
--- a/Modules/_io/stringio.c
+++ b/Modules/_io/stringio.c
@@ -899,7 +899,7 @@ stringio_setstate(stringio *self, PyObject *state)
/* Set carefully the position value. Alternatively, we could use the seek
method instead of modifying self->pos directly to better protect the
- object internal state against errneous (or malicious) inputs. */
+ object internal state against erroneous (or malicious) inputs. */
position_obj = PyTuple_GET_ITEM(state, 2);
if (!PyLong_Check(position_obj)) {
PyErr_Format(PyExc_TypeError,
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c
index 1042ea701923..15bfe26a044f 100644
--- a/Modules/_testcapimodule.c
+++ b/Modules/_testcapimodule.c
@@ -4523,7 +4523,7 @@ check_pyobject_forbidden_bytes_is_freed(PyObject *self, PyObject *Py_UNUSED(args
/* Initialize reference count to avoid early crash in ceval or GC */
Py_REFCNT(op) = 1;
/* ob_type field is after the memory block: part of "forbidden bytes"
- when using debug hooks on memory allocatrs! */
+ when using debug hooks on memory allocators! */
return test_pyobject_is_freed("check_pyobject_forbidden_bytes_is_freed", op);
}
diff --git a/Modules/expat/loadlibrary.c b/Modules/expat/loadlibrary.c
index 35fdf98bce6c..2f80b3a379fd 100644
--- a/Modules/expat/loadlibrary.c
+++ b/Modules/expat/loadlibrary.c
@@ -53,12 +53,12 @@ typedef HMODULE (APIENTRY *LOADLIBRARYEX_FN)(LPCTSTR, HANDLE, DWORD);
/* See function definitions in winbase.h */
#ifdef UNICODE
# ifdef _WIN32_WCE
-# define LOADLIBARYEX L"LoadLibraryExW"
+# define LOADLIBRARYEX L"LoadLibraryExW"
# else
-# define LOADLIBARYEX "LoadLibraryExW"
+# define LOADLIBRARYEX "LoadLibraryExW"
# endif
#else
-# define LOADLIBARYEX "LoadLibraryExA"
+# define LOADLIBRARYEX "LoadLibraryExA"
#endif
@@ -88,7 +88,7 @@ HMODULE _Expat_LoadLibrary(LPCTSTR filename)
/* Attempt to find LoadLibraryEx() which is only available on Windows 2000
and above */
- pLoadLibraryEx = (LOADLIBRARYEX_FN) GetProcAddress(hKernel32, LOADLIBARYEX);
+ pLoadLibraryEx = (LOADLIBRARYEX_FN) GetProcAddress(hKernel32, LOADLIBRARYEX);
/* Detect if there's already a path in the filename and load the library if
there is. Note: Both back slashes and forward slashes have been supported
diff --git a/Modules/expat/xmlparse.c b/Modules/expat/xmlparse.c
index 9c0987f4f6d8..311dbc4dfb9c 100644
--- a/Modules/expat/xmlparse.c
+++ b/Modules/expat/xmlparse.c
@@ -3399,7 +3399,7 @@ storeAtts(XML_Parser parser, const ENCODING *enc,
* 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/termios.c b/Modules/termios.c
index 7601b68afda3..aee7f12c57ca 100644
--- a/Modules/termios.c
+++ b/Modules/termios.c
@@ -18,7 +18,7 @@
#include <sys/ioctl.h>
/* HP-UX requires that this be included to pick up MDCD, MCTS, MDSR,
- * MDTR, MRI, and MRTS (appearantly used internally by some things
+ * MDTR, MRI, and MRTS (apparently used internally by some things
* defined as macros; these are not used here directly).
*/
#ifdef HAVE_SYS_MODEM_H
diff --git a/Objects/listsort.txt b/Objects/listsort.txt
index 8c877515c72e..43fe1574c323 100644
--- a/Objects/listsort.txt
+++ b/Objects/listsort.txt
@@ -328,7 +328,7 @@ found is still high in the memory hierarchy. We also can't delay merging
unmerged, and the stack has a fixed size.
What turned out to be a good compromise maintains two invariants on the
-stack entries, where A, B and C are the lengths of the three righmost not-yet
+stack entries, where A, B and C are the lengths of the three rightmost not-yet
merged slices:
1. A > B+C
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 6d94bc998981..bf0c3e072919 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -117,7 +117,7 @@ find_signature(const char *name, const char *doc)
#define SIGNATURE_END_MARKER ")\n--\n\n"
#define SIGNATURE_END_MARKER_LENGTH 6
/*
- * skips past the end of the docstring's instrospection signature.
+ * skips past the end of the docstring's introspection signature.
* (assumes doc starts with a valid signature prefix.)
*/
static const char *
diff --git a/Python/ast.c b/Python/ast.c
index 9947824de744..79a29a6628ad 100644
--- a/Python/ast.c
+++ b/Python/ast.c
@@ -5359,7 +5359,7 @@ typedef struct {
doubling the number allocated each time. Note that the f-string
f'{0}a{1}' contains 3 expr_ty's: 2 FormattedValue's, and one
Constant for the literal 'a'. So you add expr_ty's about twice as
- fast as you add exressions in an f-string. */
+ fast as you add expressions in an f-string. */
Py_ssize_t allocated; /* Number we've allocated. */
Py_ssize_t size; /* Number we've used. */
diff --git a/Python/pystate.c b/Python/pystate.c
index 833e0fb30dcb..8f30c94096b0 100644
--- a/Python/pystate.c
+++ b/Python/pystate.c
@@ -730,7 +730,7 @@ PyState_RemoveModule(struct PyModuleDef* def)
return -1;
}
if (state->modules_by_index == NULL) {
- Py_FatalError("PyState_RemoveModule: Interpreters module-list not acessible.");
+ Py_FatalError("PyState_RemoveModule: Interpreters module-list not accessible.");
return -1;
}
if (index > PyList_GET_SIZE(state->modules_by_index)) {
@@ -885,7 +885,7 @@ PyThreadState_DeleteCurrent()
* Note that, if there is a current thread state, it *must* be the one
* passed as argument. Also, this won't touch any other interpreters
* than the current one, since we don't know which thread state should
- * be kept in those other interpreteres.
+ * be kept in those other interpreters.
*/
void
_PyThreadState_DeleteExcept(_PyRuntimeState *runtime, PyThreadState *tstate)
https://github.com/python/cpython/commit/3d75857dfa0e50dd6e5439e8bd92c07c5d…
commit: 3d75857dfa0e50dd6e5439e8bd92c07c5d5e9839
branch: 3.8
author: Miss Islington (bot) <31488909+miss-islington(a)users.noreply.github.com>
committer: GitHub <noreply(a)github.com>
date: 2019-08-30T13:36:06-07:00
summary:
IDLE: Fix 2 typos found by Min ho Kim. (GH-15617)
(cherry picked from commit 15119bc2a7e902ae1c6988556c3bef3de87fa789)
Co-authored-by: Terry Jan Reedy <tjreedy(a)udel.edu>
files:
M Lib/idlelib/README.txt
M Lib/idlelib/browser.py
diff --git a/Lib/idlelib/README.txt b/Lib/idlelib/README.txt
index 42c3506699ba..48a1f4a425c9 100644
--- a/Lib/idlelib/README.txt
+++ b/Lib/idlelib/README.txt
@@ -115,7 +115,7 @@ tooltip.py # unused
IDLE MENUS
Top level items and most submenu items are defined in mainmenu.
-Extenstions add submenu items when active. The names given are
+Extensions add submenu items when active. The names given are
found, quoted, in one of these modules, paired with a '<<pseudoevent>>'.
Each pseudoevent is bound to an event handler. Some event handlers
call another function that does the actual work. The annotations below
diff --git a/Lib/idlelib/browser.py b/Lib/idlelib/browser.py
index e5b0bc53c662..3c3a53a6599a 100644
--- a/Lib/idlelib/browser.py
+++ b/Lib/idlelib/browser.py
@@ -29,7 +29,7 @@ def transform_children(child_dict, modname=None):
The dictionary maps names to pyclbr information objects.
Filter out imported objects.
Augment class names with bases.
- The insertion order of the dictonary is assumed to have been in line
+ The insertion order of the dictionary is assumed to have been in line
number order, so sorting is not necessary.
The current tree only calls this once per child_dict as it saves
https://github.com/python/cpython/commit/9a28400aace26597b35950ac561d49c102…
commit: 9a28400aace26597b35950ac561d49c102b6daf4
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington(a)users.noreply.github.com>
committer: GitHub <noreply(a)github.com>
date: 2019-08-30T13:34:48-07:00
summary:
IDLE: Fix 2 typos found by Min ho Kim. (GH-15617)
(cherry picked from commit 15119bc2a7e902ae1c6988556c3bef3de87fa789)
Co-authored-by: Terry Jan Reedy <tjreedy(a)udel.edu>
files:
M Lib/idlelib/README.txt
M Lib/idlelib/browser.py
diff --git a/Lib/idlelib/README.txt b/Lib/idlelib/README.txt
index 42c3506699ba..48a1f4a425c9 100644
--- a/Lib/idlelib/README.txt
+++ b/Lib/idlelib/README.txt
@@ -115,7 +115,7 @@ tooltip.py # unused
IDLE MENUS
Top level items and most submenu items are defined in mainmenu.
-Extenstions add submenu items when active. The names given are
+Extensions add submenu items when active. The names given are
found, quoted, in one of these modules, paired with a '<<pseudoevent>>'.
Each pseudoevent is bound to an event handler. Some event handlers
call another function that does the actual work. The annotations below
diff --git a/Lib/idlelib/browser.py b/Lib/idlelib/browser.py
index e5b0bc53c662..3c3a53a6599a 100644
--- a/Lib/idlelib/browser.py
+++ b/Lib/idlelib/browser.py
@@ -29,7 +29,7 @@ def transform_children(child_dict, modname=None):
The dictionary maps names to pyclbr information objects.
Filter out imported objects.
Augment class names with bases.
- The insertion order of the dictonary is assumed to have been in line
+ The insertion order of the dictionary is assumed to have been in line
number order, so sorting is not necessary.
The current tree only calls this once per child_dict as it saves