Skip to content

Commit ea5cf37

Browse files
committed
Merge branch 'master' into decimal-ac/144650
# Conflicts: # Modules/_decimal/clinic/_decimal.c.h
2 parents 2192148 + 7159b15 commit ea5cf37

334 files changed

Lines changed: 28495 additions & 16899 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.gitattributes‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ Modules/_testinternalcapi/test_cases.c.h generated
102102
Modules/_testinternalcapi/test_targets.h generated
103103
PC/python3dll.c generated
104104
Parser/parser.c generated
105+
Parser/parser_invalid.c generated
105106
Parser/token.c generated
106107
Programs/test_frozenmain.h generated
107108
Python/Python-ast.c generated

‎.github/CODEOWNERS‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@ Python/optimizer_symbols.c @markshannon @tomasr8 @Fidget-Spinner
302302

303303
# Parser, Lexer, and Grammar
304304
Grammar/python.gram @pablogsal @lysnikolaou
305+
Grammar/invalid.gram @pablogsal @lysnikolaou
305306
Lib/test/test_peg_generator/ @pablogsal @lysnikolaou
306307
Lib/test/test_tokenize.py @pablogsal @lysnikolaou
307308
Lib/tokenize.py @pablogsal @lysnikolaou

‎.github/VULNERABILITY_REPORT.yml‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ body:
5151
- "3.15"
5252
- "3.16"
5353
- "CPython main branch"
54-
validations:
55-
required: true
5654
- type: textarea
5755
id: patch
5856
attributes:

‎.github/workflows/reusable-test-lazy-imports-all.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ jobs:
6464
- name: Verify excluded tests still need exclusion
6565
run: |
6666
set -euo pipefail
67+
# Failures are expected here, don't report them to the job summary
68+
unset GITHUB_STEP_SUMMARY
6769
unexpected_passes=()
6870
while IFS= read -r test_name; do
6971
[ -n "$test_name" ] || continue

‎.gitignore‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,19 @@ Lib/test/data/*
7272
/_bootstrap_python
7373
/Makefile
7474
/Makefile.pre
75-
/iOSTestbed.*
76-
Apple/iOS/Frameworks/
77-
Apple/iOS/Resources/Info.plist
78-
Apple/testbed/build
75+
/AppleTestbed.*
76+
Platforms/Apple/iOS/Frameworks/*
77+
Platforms/Apple/iOS/Resources/Info.plist
7978
Platforms/Apple/testbed/Python*.xcframework/*/bin
8079
Platforms/Apple/testbed/Python*.xcframework/*/include
8180
Platforms/Apple/testbed/Python*.xcframework/*/lib
8281
Platforms/Apple/testbed/Python*.xcframework/*/Python*.framework
83-
Apple/testbed/*Testbed.xcodeproj/project.xcworkspace
84-
Apple/testbed/*Testbed.xcodeproj/xcuserdata
82+
Platforms/Apple/tvOS/Frameworks/*
83+
Platforms/Apple/tvOS/Resources/Info.plist
84+
Platforms/Apple/visionOS/Frameworks/*
85+
Platforms/Apple/visionOS/Resources/Info.plist
86+
Platforms/Apple/watchOS/Frameworks/*
87+
Platforms/Apple/watchOS/Resources/Info.plist
8588
Mac/Makefile
8689
Mac/PythonLauncher/Info.plist
8790
Mac/PythonLauncher/Makefile

‎Doc/builtins/functions.rst‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,10 @@ are always available. They are listed here in alphabetical order.
354354
consists of a single expression, or ``'single'`` if it consists of a single
355355
interactive statement (in the latter case, expression statements that
356356
evaluate to something other than ``None`` will be printed).
357+
It can also be ``'func_type'`` if *source* consists of a
358+
function type signature, for example ``(int) -> str``; see
359+
:func:`ast.parse` for more information. This mode requires passing
360+
:data:`ast.PyCF_ONLY_AST` in *flags*.
357361

358362
The optional arguments *flags* and *dont_inherit* control which
359363
:ref:`compiler options <ast-compiler-flags>` should be activated
@@ -427,6 +431,9 @@ are always available. They are listed here in alphabetical order.
427431
``ast.PyCF_ALLOW_TOP_LEVEL_AWAIT`` can now be passed in flags to enable
428432
support for top-level ``await``, ``async for``, and ``async with``.
429433

434+
.. versionchanged:: 3.8
435+
Added support for ``mode='func_type'``.
436+
430437
.. versionchanged:: 3.12
431438
:exc:`SyntaxError` is raised instead of :exc:`ValueError` when null bytes
432439
are encountered in *source*.

‎Doc/c-api/code.rst‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,12 @@ bound into a function.
9494
9595
.. c:function:: int PyCode_Addr2Line(PyCodeObject *co, int byte_offset)
9696
97-
Return the line number of the instruction that occurs on or before ``byte_offset`` and ends after it.
98-
If you just need the line number of a frame, use :c:func:`PyFrame_GetLineNumber` instead.
97+
Return the line number of the instruction that occurs on or before
98+
``byte_offset`` and ends after it. This may be ``O(N)`` in the number of
99+
instructions in the code object, so it is not performant for iterating over
100+
all the line numbers in a code object.
99101
100-
For efficiently iterating over the line numbers in a code object, use :pep:`the API described in PEP 626
101-
<0626#out-of-process-debuggers-and-profilers>`.
102+
If you just need the line number of a frame, use :c:func:`PyFrame_GetLineNumber` instead.
102103
103104
.. c:function:: int PyCode_Addr2Location(PyObject *co, int byte_offset, int *start_line, int *start_column, int *end_line, int *end_column)
104105

‎Doc/c-api/intro.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -935,7 +935,7 @@ use them.
935935
PY_SSIZE_T_MIN
936936
937937
The limit values (largest positive one and smallest negative one,
938-
respecitvely) of type :c:type:`Py_ssize_t`.
938+
respectively) of type :c:type:`Py_ssize_t`.
939939

940940

941941
.. c:macro:: PY_DWORD_MAX

‎Doc/c-api/pyexpat.rst‎

Lines changed: 77 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,27 @@ Expat C API
66
The :mod:`xml.parsers.expat` module exposes selected Expat functions
77
through its ``expat_CAPI`` capsule. This allows extension modules to use the
88
same Expat library as Python. The interface is declared in :file:`pyexpat.h`,
9-
which must be included after Expat's :file:`expat.h` header.
9+
which is not included by :file:`Python.h` and must be included after Expat's
10+
:file:`expat.h` header.
11+
12+
To use the C API, add the following code to the extension module
13+
initialization function and store the pointer to the C API in the module
14+
state:
15+
16+
.. code-block::
17+
18+
struct PyExpat_CAPI *capi = NULL;
19+
capi = (struct PyExpat_CAPI *)PyCapsule_Import(PyExpat_CAPSULE_NAME, 0);
20+
if (capi == NULL) {
21+
goto error;
22+
}
23+
if (!(
24+
strcmp(capi->magic, PyExpat_CAPI_MAGIC) == 0
25+
&& (size_t)capi->size >= sizeof(struct PyExpat_CAPI)
26+
)) {
27+
PyErr_SetString(PyExc_ImportError, "pyexpat version is incompatible");
28+
goto error;
29+
}
1030
1131
.. c:macro:: PyExpat_CAPSULE_NAME
1232
@@ -20,7 +40,7 @@ which must be included after Expat's :file:`expat.h` header.
2040
The string identifying the layout of :c:struct:`PyExpat_CAPI`.
2141
Before using the function pointers in the structure, check that
2242
its ``magic`` member compares equal to this string using ``strcmp()``
23-
and its ``size`` member is at least :c:expr:`sizeof(struct PyExpat_CAPI)`.
43+
and its ``size`` member is at least :c:expr:`sizeof(struct PyExpat_CAPI)`.
2444

2545

2646
.. c:struct:: PyExpat_CAPI
@@ -46,7 +66,8 @@ which must be included after Expat's :file:`expat.h` header.
4666
int MICRO_VERSION
4767
4868
Major, minor, and micro version numbers of the Expat library used by
49-
:mod:`xml.parsers.expat`.
69+
:mod:`xml.parsers.expat`, set to ``XML_MAJOR_VERSION``,
70+
``XML_MINOR_VERSION``, and ``XML_MICRO_VERSION`` respectively.
5071

5172
.. c:member:: void (*SetUnknownEncodingHandler)(XML_Parser parser, XML_UnknownEncodingHandler handler, void *encodingHandlerData)
5273
@@ -63,14 +84,15 @@ which must be included after Expat's :file:`expat.h` header.
6384
The *encodingHandlerData* argument is unused.
6485
Calling this handler requires an :term:`attached thread state`.
6586

87+
.. versionadded:: 3.3
88+
6689
Pointers to the corresponding Expat functions, or ``NULL`` if not
6790
available in the Expat version used by :mod:`xml.parsers.expat`, are
6891
listed below.
6992

7093
Member names omit the ``XML_`` prefix; for example, ``SetHashSalt``
7194
exposes Expat's ``XML_SetHashSalt`` function. See the `Expat API reference
72-
<https://libexpat.github.io/doc/api/latest/>`_ for their behavior
73-
and the minimum Expat version they appear in.
95+
<https://libexpat.github.io/doc/api/latest/>`_ for their behavior.
7496

7597
.. c:member:: const XML_LChar *(*ErrorString)(enum XML_Error code)
7698
enum XML_Error (*GetErrorCode)(XML_Parser parser)
@@ -86,14 +108,53 @@ which must be included after Expat's :file:`expat.h` header.
86108
void (*SetNamespaceDeclHandler)(XML_Parser parser, XML_StartNamespaceDeclHandler start, XML_EndNamespaceDeclHandler end)
87109
void (*SetProcessingInstructionHandler)(XML_Parser parser, XML_ProcessingInstructionHandler handler)
88110
void (*SetUserData)(XML_Parser parser, void *userData)
89-
void (*SetStartDoctypeDeclHandler)(XML_Parser parser, XML_StartDoctypeDeclHandler start)
90-
enum XML_Status (*SetEncoding)(XML_Parser parser, const XML_Char *encoding)
91-
int (*SetHashSalt)(XML_Parser parser, unsigned long hash_salt)
92-
XML_Bool (*SetReparseDeferralEnabled)(XML_Parser parser, XML_Bool enabled)
93-
XML_Bool (*SetAllocTrackerActivationThreshold)(XML_Parser parser, unsigned long long activationThresholdBytes)
94-
XML_Bool (*SetAllocTrackerMaximumAmplification)(XML_Parser parser, float maxAmplificationFactor)
95-
XML_Bool (*SetBillionLaughsAttackProtectionActivationThreshold)(XML_Parser parser, unsigned long long activationThresholdBytes)
96-
XML_Bool (*SetBillionLaughsAttackProtectionMaximumAmplification)(XML_Parser parser, float maxAmplificationFactor)
97-
XML_Bool (*SetHashSalt16Bytes)(XML_Parser parser, const uint8_t entropy[16])
98-
99-
See the `Expat API reference <https://libexpat.github.io/doc/api/latest/>`_.
111+
112+
.. c:member:: void (*SetStartDoctypeDeclHandler)(XML_Parser parser, XML_StartDoctypeDeclHandler start)
113+
114+
.. versionadded:: 3.2
115+
116+
.. c:member:: enum XML_Status (*SetEncoding)(XML_Parser parser, const XML_Char *encoding)
117+
118+
.. versionadded:: 3.3
119+
120+
.. c:member:: int (*SetHashSalt)(XML_Parser parser, unsigned long hash_salt)
121+
122+
Might be ``NULL`` for Expat versions prior to 2.1.0.
123+
124+
.. versionadded:: 3.4
125+
126+
.. c:member:: XML_Bool (*SetReparseDeferralEnabled)(XML_Parser parser, XML_Bool enabled)
127+
128+
Might be ``NULL`` for Expat versions prior to 2.6.0.
129+
130+
.. versionadded:: 3.8
131+
132+
.. c:member:: XML_Bool (*SetAllocTrackerActivationThreshold)(XML_Parser parser, unsigned long long activationThresholdBytes)
133+
134+
Might be ``NULL`` for Expat versions prior to 2.7.2.
135+
136+
.. versionadded:: 3.10
137+
138+
.. c:member:: XML_Bool (*SetAllocTrackerMaximumAmplification)(XML_Parser parser, float maxAmplificationFactor)
139+
140+
Might be ``NULL`` for Expat versions prior to 2.7.2.
141+
142+
.. versionadded:: 3.10
143+
144+
.. c:member:: XML_Bool (*SetBillionLaughsAttackProtectionActivationThreshold)(XML_Parser parser, unsigned long long activationThresholdBytes)
145+
146+
Might be ``NULL`` for Expat versions prior to 2.4.0.
147+
148+
.. versionadded:: 3.10
149+
150+
.. c:member:: XML_Bool (*SetBillionLaughsAttackProtectionMaximumAmplification)(XML_Parser parser, float maxAmplificationFactor)
151+
152+
Might be ``NULL`` for Expat versions prior to 2.4.0.
153+
154+
.. versionadded:: 3.10
155+
156+
.. c:member:: XML_Bool (*SetHashSalt16Bytes)(XML_Parser parser, const uint8_t entropy[16])
157+
158+
Might be ``NULL`` for Expat versions prior to 2.8.0.
159+
160+
.. versionadded:: 3.16

‎Doc/conf.py‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,13 @@
8686
.. |python_x_dot_y_literal| replace:: ``python{version}``
8787
.. |python_x_dot_y_t_literal| replace:: ``python{version}t``
8888
.. |python_x_dot_y_t_literal_config| replace:: ``python{version}t-config``
89+
.. |python_x_dot_y_exe_literal| replace:: ``python{version}.exe``
90+
.. |python_x_dot_y_t_exe_literal| replace:: ``python{version}t.exe``
91+
.. |python_xy_dll_literal| replace:: ``python{v.major}{v.minor}.dll``
92+
.. |py_v_x_dot_y_literal| replace:: ``py -V:{version}``
93+
.. |py_v_x_dot_y_t_literal| replace:: ``py -V:{version}t``
94+
.. |x_dot_y_literal| replace:: ``{version}``
95+
.. |x_dot_y_64_literal| replace:: ``{version}-64``
8996
.. |x_dot_y_b2_literal| replace:: ``{version}.0b2``
9097
.. |applications_python_version_literal| replace:: ``/Applications/Python {version}/``
9198
.. |usr_local_bin_python_x_dot_y_literal| replace:: ``/usr/local/bin/python{version}``

0 commit comments

Comments
 (0)