Skip to content

Commit 1c1e22a

Browse files
committed
Merge in the main branch
2 parents 67219f1 + 2fbd396 commit 1c1e22a

75 files changed

Lines changed: 962 additions & 435 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.

.github/workflows/jit.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
- true
6969
- false
7070
llvm:
71-
- 20
71+
- 21
7272
include:
7373
- target: i686-pc-windows-msvc/msvc
7474
architecture: Win32
@@ -138,7 +138,7 @@ jobs:
138138
fail-fast: false
139139
matrix:
140140
llvm:
141-
- 20
141+
- 21
142142
steps:
143143
- uses: actions/checkout@v4
144144
with:
@@ -166,7 +166,7 @@ jobs:
166166
fail-fast: false
167167
matrix:
168168
llvm:
169-
- 20
169+
- 21
170170
steps:
171171
- uses: actions/checkout@v4
172172
with:
@@ -193,7 +193,7 @@ jobs:
193193
fail-fast: false
194194
matrix:
195195
llvm:
196-
- 20
196+
- 21
197197
steps:
198198
- uses: actions/checkout@v4
199199
with:

Apple/testbed/__main__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import json
33
import os
44
import re
5+
import shlex
56
import shutil
67
import subprocess
78
import sys
@@ -252,7 +253,7 @@ def update_test_plan(testbed_path, platform, args):
252253
test_plan = json.load(f)
253254

254255
test_plan["defaultOptions"]["commandLineArgumentEntries"] = [
255-
{"argument": arg} for arg in args
256+
{"argument": shlex.quote(arg)} for arg in args
256257
]
257258

258259
with test_plan_path.open("w", encoding="utf-8") as f:

Doc/c-api/float.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,20 +99,37 @@ Floating-Point Objects
9999
the C11 standard ``<math.h>`` header.
100100
101101
102+
.. c:macro:: Py_MATH_E
103+
104+
The definition (accurate for a :c:expr:`double` type) of the :data:`math.e` constant.
105+
106+
102107
.. c:macro:: Py_MATH_El
103108
104109
High precision (long double) definition of :data:`~math.e` constant.
105110
106111
.. deprecated-removed:: 3.15 3.20
107112
108113
114+
.. c:macro:: Py_MATH_PI
115+
116+
The definition (accurate for a :c:expr:`double` type) of the :data:`math.pi` constant.
117+
118+
109119
.. c:macro:: Py_MATH_PIl
110120
111121
High precision (long double) definition of :data:`~math.pi` constant.
112122
113123
.. deprecated-removed:: 3.15 3.20
114124
115125
126+
.. c:macro:: Py_MATH_TAU
127+
128+
The definition (accurate for a :c:expr:`double` type) of the :data:`math.tau` constant.
129+
130+
.. versionadded:: 3.6
131+
132+
116133
.. c:macro:: Py_RETURN_NAN
117134
118135
Return :data:`math.nan` from a function.

Doc/c-api/type.rst

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,12 +195,14 @@ Type Objects
195195
before initialization) and should be paired with :c:func:`PyObject_Free` in
196196
:c:member:`~PyTypeObject.tp_free`.
197197
198+
198199
.. c:function:: PyObject* PyType_GenericNew(PyTypeObject *type, PyObject *args, PyObject *kwds)
199200
200201
Generic handler for the :c:member:`~PyTypeObject.tp_new` slot of a type
201202
object. Creates a new instance using the type's
202203
:c:member:`~PyTypeObject.tp_alloc` slot and returns the resulting object.
203204
205+
204206
.. c:function:: int PyType_Ready(PyTypeObject *type)
205207
206208
Finalize a type object. This should be called on all type objects to finish
@@ -217,13 +219,15 @@ Type Objects
217219
GC protocol itself by at least implementing the
218220
:c:member:`~PyTypeObject.tp_traverse` handle.
219221
222+
220223
.. c:function:: PyObject* PyType_GetName(PyTypeObject *type)
221224
222225
Return the type's name. Equivalent to getting the type's
223226
:attr:`~type.__name__` attribute.
224227
225228
.. versionadded:: 3.11
226229
230+
227231
.. c:function:: PyObject* PyType_GetQualName(PyTypeObject *type)
228232
229233
Return the type's qualified name. Equivalent to getting the
@@ -239,13 +243,15 @@ Type Objects
239243
240244
.. versionadded:: 3.13
241245
246+
242247
.. c:function:: PyObject* PyType_GetModuleName(PyTypeObject *type)
243248
244249
Return the type's module name. Equivalent to getting the
245250
:attr:`type.__module__` attribute.
246251
247252
.. versionadded:: 3.13
248253
254+
249255
.. c:function:: void* PyType_GetSlot(PyTypeObject *type, int slot)
250256
251257
Return the function pointer stored in the given slot. If the
@@ -262,6 +268,7 @@ Type Objects
262268
:c:func:`PyType_GetSlot` can now accept all types.
263269
Previously, it was limited to :ref:`heap types <heap-types>`.
264270
271+
265272
.. c:function:: PyObject* PyType_GetModule(PyTypeObject *type)
266273
267274
Return the module object associated with the given type when the type was
@@ -281,6 +288,7 @@ Type Objects
281288
282289
.. versionadded:: 3.9
283290
291+
284292
.. c:function:: void* PyType_GetModuleState(PyTypeObject *type)
285293
286294
Return the state of the module object associated with the given type.
@@ -295,6 +303,7 @@ Type Objects
295303
296304
.. versionadded:: 3.9
297305
306+
298307
.. c:function:: PyObject* PyType_GetModuleByToken(PyTypeObject *type, const void *token)
299308
300309
Find the first superclass whose module has the given *token*, and
@@ -312,6 +321,7 @@ Type Objects
312321
313322
.. versionadded:: next
314323
324+
315325
.. c:function:: PyObject* PyType_GetModuleByDef(PyTypeObject *type, struct PyModuleDef *def)
316326
317327
Find the first superclass whose module was created from the given
@@ -330,6 +340,7 @@ Type Objects
330340
331341
.. versionadded:: 3.11
332342
343+
333344
.. c:function:: int PyType_GetBaseByToken(PyTypeObject *type, void *token, PyTypeObject **result)
334345
335346
Find the first superclass in *type*'s :term:`method resolution order` whose
@@ -348,6 +359,7 @@ Type Objects
348359
349360
.. versionadded:: 3.14
350361
362+
351363
.. c:function:: int PyUnstable_Type_AssignVersionTag(PyTypeObject *type)
352364
353365
Attempt to assign a version tag to the given type.
@@ -358,6 +370,16 @@ Type Objects
358370
.. versionadded:: 3.12
359371
360372
373+
.. c:function:: int PyType_SUPPORTS_WEAKREFS(PyTypeObject *type)
374+
375+
Return true if instances of *type* support creating weak references, false
376+
otherwise. This function always succeeds. *type* must not be ``NULL``.
377+
378+
.. seealso::
379+
* :ref:`weakrefobjects`
380+
* :py:mod:`weakref`
381+
382+
361383
Creating Heap-Allocated Types
362384
.............................
363385
@@ -406,6 +428,7 @@ The following functions and structs are used to create
406428
407429
.. versionadded:: 3.12
408430
431+
409432
.. c:function:: PyObject* PyType_FromModuleAndSpec(PyObject *module, PyType_Spec *spec, PyObject *bases)
410433
411434
Equivalent to ``PyType_FromMetaclass(NULL, module, spec, bases)``.
@@ -432,6 +455,7 @@ The following functions and structs are used to create
432455
Creating classes whose metaclass overrides
433456
:c:member:`~PyTypeObject.tp_new` is no longer allowed.
434457
458+
435459
.. c:function:: PyObject* PyType_FromSpecWithBases(PyType_Spec *spec, PyObject *bases)
436460
437461
Equivalent to ``PyType_FromMetaclass(NULL, NULL, spec, bases)``.
@@ -453,6 +477,7 @@ The following functions and structs are used to create
453477
Creating classes whose metaclass overrides
454478
:c:member:`~PyTypeObject.tp_new` is no longer allowed.
455479
480+
456481
.. c:function:: PyObject* PyType_FromSpec(PyType_Spec *spec)
457482
458483
Equivalent to ``PyType_FromMetaclass(NULL, NULL, spec, NULL)``.
@@ -473,6 +498,7 @@ The following functions and structs are used to create
473498
Creating classes whose metaclass overrides
474499
:c:member:`~PyTypeObject.tp_new` is no longer allowed.
475500
501+
476502
.. c:function:: int PyType_Freeze(PyTypeObject *type)
477503
478504
Make a type immutable: set the :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` flag.
@@ -644,6 +670,7 @@ The following functions and structs are used to create
644670
* :c:data:`Py_tp_token` (for clarity, prefer :c:data:`Py_TP_USE_SPEC`
645671
rather than ``NULL``)
646672
673+
647674
.. c:macro:: Py_tp_token
648675
649676
A :c:member:`~PyType_Slot.slot` that records a static memory layout ID

Doc/c-api/veryhigh.rst

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,18 +100,12 @@ the same library that the Python runtime is using.
100100
Otherwise, Python may not handle script file with LF line ending correctly.
101101
102102
103-
.. c:function:: int PyRun_InteractiveOne(FILE *fp, const char *filename)
104-
105-
This is a simplified interface to :c:func:`PyRun_InteractiveOneFlags` below,
106-
leaving *flags* set to ``NULL``.
107-
108-
109-
.. c:function:: int PyRun_InteractiveOneFlags(FILE *fp, const char *filename, PyCompilerFlags *flags)
103+
.. c:function:: int PyRun_InteractiveOneObject(FILE *fp, PyObject *filename, PyCompilerFlags *flags)
110104
111105
Read and execute a single statement from a file associated with an
112106
interactive device according to the *flags* argument. The user will be
113-
prompted using ``sys.ps1`` and ``sys.ps2``. *filename* is decoded from the
114-
:term:`filesystem encoding and error handler`.
107+
prompted using ``sys.ps1`` and ``sys.ps2``. *filename* must be a Python
108+
:class:`str` object.
115109
116110
Returns ``0`` when the input was
117111
executed successfully, ``-1`` if there was an exception, or an error code
@@ -120,6 +114,19 @@ the same library that the Python runtime is using.
120114
:file:`Python.h`, so must be included specifically if needed.)
121115
122116
117+
.. c:function:: int PyRun_InteractiveOne(FILE *fp, const char *filename)
118+
119+
This is a simplified interface to :c:func:`PyRun_InteractiveOneFlags` below,
120+
leaving *flags* set to ``NULL``.
121+
122+
123+
.. c:function:: int PyRun_InteractiveOneFlags(FILE *fp, const char *filename, PyCompilerFlags *flags)
124+
125+
Similar to :c:func:`PyRun_InteractiveOneObject`, but *filename* is a
126+
:c:expr:`const char*`, which is decoded from the
127+
:term:`filesystem encoding and error handler`.
128+
129+
123130
.. c:function:: int PyRun_InteractiveLoop(FILE *fp, const char *filename)
124131
125132
This is a simplified interface to :c:func:`PyRun_InteractiveLoopFlags` below,

Doc/c-api/weakref.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ as much as it can.
4545
weakly referenceable object, or if *callback* is not callable, ``None``, or
4646
``NULL``, this will return ``NULL`` and raise :exc:`TypeError`.
4747
48+
.. seealso::
49+
:c:func:`PyType_SUPPORTS_WEAKREFS` for checking if *ob* is weakly
50+
referenceable.
51+
4852
4953
.. c:function:: PyObject* PyWeakref_NewProxy(PyObject *ob, PyObject *callback)
5054
@@ -57,6 +61,10 @@ as much as it can.
5761
is not a weakly referenceable object, or if *callback* is not callable,
5862
``None``, or ``NULL``, this will return ``NULL`` and raise :exc:`TypeError`.
5963
64+
.. seealso::
65+
:c:func:`PyType_SUPPORTS_WEAKREFS` for checking if *ob* is weakly
66+
referenceable.
67+
6068
6169
.. c:function:: int PyWeakref_GetRef(PyObject *ref, PyObject **pobj)
6270

Doc/library/ast.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2205,10 +2205,10 @@ Async and await
22052205
Apart from the node classes, the :mod:`ast` module defines these utility functions
22062206
and classes for traversing abstract syntax trees:
22072207

2208-
.. function:: parse(source, filename='<unknown>', mode='exec', *, type_comments=False, feature_version=None, optimize=-1)
2208+
.. function:: parse(source, filename='<unknown>', mode='exec', *, type_comments=False, feature_version=None, optimize=-1, module=None)
22092209

22102210
Parse the source into an AST node. Equivalent to ``compile(source,
2211-
filename, mode, flags=FLAGS_VALUE, optimize=optimize)``,
2211+
filename, mode, flags=FLAGS_VALUE, optimize=optimize, module=module)``,
22122212
where ``FLAGS_VALUE`` is ``ast.PyCF_ONLY_AST`` if ``optimize <= 0``
22132213
and ``ast.PyCF_OPTIMIZED_AST`` otherwise.
22142214

@@ -2261,6 +2261,9 @@ and classes for traversing abstract syntax trees:
22612261
The minimum supported version for ``feature_version`` is now ``(3, 7)``.
22622262
The ``optimize`` argument was added.
22632263

2264+
.. versionadded:: next
2265+
Added the *module* parameter.
2266+
22642267

22652268
.. function:: unparse(ast_obj)
22662269

Doc/library/functions.rst

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,9 @@ are always available. They are listed here in alphabetical order.
292292
:func:`property`.
293293

294294

295-
.. function:: compile(source, filename, mode, flags=0, dont_inherit=False, optimize=-1)
295+
.. function:: compile(source, filename, mode, flags=0, \
296+
dont_inherit=False, optimize=-1, \
297+
*, module=None)
296298
297299
Compile the *source* into a code or AST object. Code objects can be executed
298300
by :func:`exec` or :func:`eval`. *source* can either be a normal string, a
@@ -334,6 +336,10 @@ are always available. They are listed here in alphabetical order.
334336
``__debug__`` is true), ``1`` (asserts are removed, ``__debug__`` is false)
335337
or ``2`` (docstrings are removed too).
336338

339+
The optional argument *module* specifies the module name.
340+
It is needed to unambiguous :ref:`filter <warning-filter>` syntax warnings
341+
by module name.
342+
337343
This function raises :exc:`SyntaxError` if the compiled source is invalid,
338344
and :exc:`ValueError` if the source contains null bytes.
339345

@@ -371,6 +377,9 @@ are always available. They are listed here in alphabetical order.
371377
``ast.PyCF_ALLOW_TOP_LEVEL_AWAIT`` can now be passed in flags to enable
372378
support for top-level ``await``, ``async for``, and ``async with``.
373379

380+
.. versionadded:: next
381+
Added the *module* parameter.
382+
374383

375384
.. class:: complex(number=0, /)
376385
complex(string, /)

Doc/library/importlib.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ ABC hierarchy::
459459
.. versionchanged:: 3.4
460460
Raises :exc:`ImportError` instead of :exc:`NotImplementedError`.
461461

462-
.. staticmethod:: source_to_code(data, path='<string>')
462+
.. staticmethod:: source_to_code(data, path='<string>', fullname=None)
463463

464464
Create a code object from Python source.
465465

@@ -471,11 +471,19 @@ ABC hierarchy::
471471
With the subsequent code object one can execute it in a module by
472472
running ``exec(code, module.__dict__)``.
473473

474+
The optional argument *fullname* specifies the module name.
475+
It is needed to unambiguous :ref:`filter <warning-filter>` syntax
476+
warnings by module name.
477+
474478
.. versionadded:: 3.4
475479

476480
.. versionchanged:: 3.5
477481
Made the method static.
478482

483+
.. versionadded:: next
484+
Added the *fullname* parameter.
485+
486+
479487
.. method:: exec_module(module)
480488

481489
Implementation of :meth:`Loader.exec_module`.

0 commit comments

Comments
 (0)