Skip to content

Commit 7bb0394

Browse files
committed
Merge branch 'master' into text_sign_annot
2 parents 954c71b + 04c7f36 commit 7bb0394

35 files changed

+2201
-527
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,4 @@ Python/stdlib_module_names.h generated
103103
Tools/peg_generator/pegen/grammar_parser.py generated
104104
aclocal.m4 generated
105105
configure generated
106+
*.min.js generated

Doc/c-api/long.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,11 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
4040
4141
Return a new :c:type:`PyLongObject` object from *v*, or ``NULL`` on failure.
4242
43-
The current implementation keeps an array of integer objects for all integers
44-
between ``-5`` and ``256``. When you create an int in that range you actually
45-
just get back a reference to the existing object.
43+
.. impl-detail::
44+
45+
CPython keeps an array of integer objects for all integers
46+
between ``-5`` and ``256``. When you create an int in that range
47+
you actually just get back a reference to the existing object.
4648
4749
4850
.. c:function:: PyObject* PyLong_FromUnsignedLong(unsigned long v)

Doc/library/codecs.rst

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,21 @@ The full details for each codec can also be looked up directly:
6868
Looks up the codec info in the Python codec registry and returns a
6969
:class:`CodecInfo` object as defined below.
7070

71-
Encodings are first looked up in the registry's cache. If not found, the list of
71+
This function first normalizes the *encoding*: all ASCII letters are
72+
converted to lower case, spaces are replaced with hyphens.
73+
Then encoding is looked up in the registry's cache. If not found, the list of
7274
registered search functions is scanned. If no :class:`CodecInfo` object is
7375
found, a :exc:`LookupError` is raised. Otherwise, the :class:`CodecInfo` object
7476
is stored in the cache and returned to the caller.
7577

78+
.. versionchanged:: 3.9
79+
Any characters except ASCII letters and digits and a dot are converted to underscore.
80+
81+
.. versionchanged:: next
82+
No characters are converted to underscore anymore.
83+
Spaces are converted to hyphens.
84+
85+
7686
.. class:: CodecInfo(encode, decode, streamreader=None, streamwriter=None, incrementalencoder=None, incrementaldecoder=None, name=None)
7787

7888
Codec details when looking up the codec registry. The constructor
@@ -167,14 +177,11 @@ function:
167177
.. function:: register(search_function, /)
168178

169179
Register a codec search function. Search functions are expected to take one
170-
argument, being the encoding name in all lower case letters with hyphens
171-
and spaces converted to underscores, and return a :class:`CodecInfo` object.
180+
argument, being the encoding name in all lower case letters with spaces
181+
converted to hyphens, and return a :class:`CodecInfo` object.
172182
In case a search function cannot find a given encoding, it should return
173183
``None``.
174184

175-
.. versionchanged:: 3.9
176-
Hyphens and spaces are converted to underscore.
177-
178185

179186
.. function:: unregister(search_function, /)
180187

@@ -1065,7 +1072,7 @@ or with dictionaries as mapping tables. The following table lists the codecs by
10651072
name, together with a few common aliases, and the languages for which the
10661073
encoding is likely used. Neither the list of aliases nor the list of languages
10671074
is meant to be exhaustive. Notice that spelling alternatives that only differ in
1068-
case or use a hyphen instead of an underscore are also valid aliases
1075+
case or use a space or a hyphen instead of an underscore are also valid aliases
10691076
because they are equivalent when normalized by
10701077
:func:`~encodings.normalize_encoding`. For example, ``'utf-8'`` is a valid
10711078
alias for the ``'utf_8'`` codec.

Doc/library/getpass.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ The :mod:`getpass` module provides two functions:
3939
If you call getpass from within IDLE, the input may be done in the
4040
terminal you launched IDLE from rather than the idle window itself.
4141

42+
.. note::
43+
On Unix systems, when *echo_char* is set, the terminal will be
44+
configured to operate in
45+
:manpage:`noncanonical mode <termios(3)#Canonical_and_noncanonical_mode>`.
46+
In particular, this means that line editing shortcuts such as
47+
:kbd:`Ctrl+U` will not work and may insert unexpected characters into
48+
the input.
49+
4250
.. versionchanged:: 3.14
4351
Added the *echo_char* parameter for keyboard feedback.
4452

Doc/library/importlib.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ Functions
124124
need to call :func:`invalidate_caches` in order for the new module to be
125125
noticed by the import system.
126126

127+
If the module cannot be imported, :func:`import_module` will raise
128+
:exc:`ImportError` or an appropriate subclass like
129+
:exc:`ModuleNotFoundError`.
130+
127131
.. versionchanged:: 3.3
128132
Parent packages are automatically imported.
129133

Doc/license.rst

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,3 +1169,33 @@ contributors. The pyzstd code is distributed under the 3-Clause BSD License::
11691169
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
11701170
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
11711171
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1172+
1173+
1174+
Profiling module
1175+
----------------
1176+
1177+
The :mod:`!profiling` module includes vendored third-party libraries in
1178+
:file:`Lib/profiling/sampling/_vendor/` with the following licenses:
1179+
1180+
**d3-flamegraph**
1181+
1182+
The d3-flamegraph library is distributed under the Apache License, Version 2.0.
1183+
See the OpenSSL section above for the full text of the Apache License Version 2.0.
1184+
1185+
**d3.js**
1186+
1187+
The d3.js library contains the following notice::
1188+
1189+
Copyright 2010-2021 Mike Bostock
1190+
1191+
Permission to use, copy, modify, and/or distribute this software for any purpose
1192+
with or without fee is hereby granted, provided that the above copyright notice
1193+
and this permission notice appear in all copies.
1194+
1195+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
1196+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
1197+
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
1198+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
1199+
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
1200+
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
1201+
THIS SOFTWARE.

Grammar/python.gram

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,9 @@ del_stmt[stmt_ty]:
212212

213213
yield_stmt[stmt_ty]: y=yield_expr { _PyAST_Expr(y, EXTRA) }
214214

215-
assert_stmt[stmt_ty]: 'assert' a=expression b=[',' z=expression { z }] { _PyAST_Assert(a, b, EXTRA) }
215+
assert_stmt[stmt_ty]:
216+
| invalid_assert_stmt
217+
| 'assert' a=expression b=[',' z=expression { z }] { _PyAST_Assert(a, b, EXTRA) }
216218

217219
import_stmt[stmt_ty]:
218220
| invalid_import
@@ -1302,6 +1304,17 @@ invalid_raise_stmt:
13021304
invalid_del_stmt:
13031305
| 'del' a=star_expressions {
13041306
RAISE_SYNTAX_ERROR_INVALID_TARGET(DEL_TARGETS, a) }
1307+
invalid_assert_stmt:
1308+
| 'assert' a=expression '=' b=expression {
1309+
RAISE_SYNTAX_ERROR_KNOWN_RANGE(
1310+
a, b,
1311+
"cannot assign to %s here. Maybe you meant '==' instead of '='?",
1312+
_PyPegen_get_expr_name(a)) }
1313+
| 'assert' expression ',' a=expression '=' b=expression {
1314+
RAISE_SYNTAX_ERROR_KNOWN_RANGE(
1315+
a, b,
1316+
"cannot assign to %s here. Maybe you meant '==' instead of '='?",
1317+
_PyPegen_get_expr_name(a)) }
13051318
invalid_block:
13061319
| NEWLINE !INDENT { RAISE_INDENTATION_ERROR("expected an indented block") }
13071320
invalid_comprehension:

Include/internal/pycore_global_objects_fini_generated.h

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Include/internal/pycore_global_strings.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,7 @@ struct _Py_global_strings {
571571
STRUCT_FOR_ID(last_value)
572572
STRUCT_FOR_ID(latin1)
573573
STRUCT_FOR_ID(leaf_size)
574+
STRUCT_FOR_ID(legacy)
574575
STRUCT_FOR_ID(len)
575576
STRUCT_FOR_ID(length)
576577
STRUCT_FOR_ID(level)
@@ -744,6 +745,7 @@ struct _Py_global_strings {
744745
STRUCT_FOR_ID(setstate)
745746
STRUCT_FOR_ID(shape)
746747
STRUCT_FOR_ID(shared)
748+
STRUCT_FOR_ID(short)
747749
STRUCT_FOR_ID(show_cmd)
748750
STRUCT_FOR_ID(signed)
749751
STRUCT_FOR_ID(signum)

Include/internal/pycore_runtime_init_generated.h

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)