Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 71bd841

Browse files
committed
Merge in the main branch
2 parents 9a40a98 + 0af7556 commit 71bd841

126 files changed

Lines changed: 1934 additions & 1097 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/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
.github/** @ezio-melotti @hugovk @AA-Turner
99

1010
# pre-commit
11-
.pre-commit-config.yaml @hugovk @AlexWaygood
11+
.pre-commit-config.yaml @hugovk
1212
.ruff.toml @hugovk @AlexWaygood @AA-Turner
1313

1414
# Build system

.github/workflows/jit.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,10 @@ jobs:
117117
find /usr/local/bin -lname '*/Library/Frameworks/Python.framework/*' -delete
118118
brew install llvm@${{ matrix.llvm }}
119119
export SDKROOT="$(xcrun --show-sdk-path)"
120+
# Set MACOSX_DEPLOYMENT_TARGET and -Werror=unguarded-availability to
121+
# make sure we don't break downstream distributors (like uv):
122+
export CFLAGS_JIT='-Werror=unguarded-availability'
123+
export MACOSX_DEPLOYMENT_TARGET=10.15
120124
./configure --enable-experimental-jit --enable-universalsdk --with-universal-archs=universal2 ${{ matrix.debug && '--with-pydebug' || '' }}
121125
make all --jobs 4
122126
./python.exe -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3

Doc/c-api/complex.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,24 +43,36 @@ pointers. This is consistent throughout the API.
4343
Return the sum of two complex numbers, using the C :c:type:`Py_complex`
4444
representation.
4545
46+
.. deprecated:: 3.15
47+
This function is :term:`soft deprecated`.
48+
4649
4750
.. c:function:: Py_complex _Py_c_diff(Py_complex left, Py_complex right)
4851
4952
Return the difference between two complex numbers, using the C
5053
:c:type:`Py_complex` representation.
5154
55+
.. deprecated:: 3.15
56+
This function is :term:`soft deprecated`.
57+
5258
5359
.. c:function:: Py_complex _Py_c_neg(Py_complex num)
5460
5561
Return the negation of the complex number *num*, using the C
5662
:c:type:`Py_complex` representation.
5763
64+
.. deprecated:: 3.15
65+
This function is :term:`soft deprecated`.
66+
5867
5968
.. c:function:: Py_complex _Py_c_prod(Py_complex left, Py_complex right)
6069
6170
Return the product of two complex numbers, using the C :c:type:`Py_complex`
6271
representation.
6372
73+
.. deprecated:: 3.15
74+
This function is :term:`soft deprecated`.
75+
6476
6577
.. c:function:: Py_complex _Py_c_quot(Py_complex dividend, Py_complex divisor)
6678
@@ -70,6 +82,9 @@ pointers. This is consistent throughout the API.
7082
If *divisor* is null, this method returns zero and sets
7183
:c:data:`errno` to :c:macro:`!EDOM`.
7284
85+
.. deprecated:: 3.15
86+
This function is :term:`soft deprecated`.
87+
7388
7489
.. c:function:: Py_complex _Py_c_pow(Py_complex num, Py_complex exp)
7590
@@ -81,6 +96,19 @@ pointers. This is consistent throughout the API.
8196
8297
Set :c:data:`errno` to :c:macro:`!ERANGE` on overflows.
8398
99+
.. deprecated:: 3.15
100+
This function is :term:`soft deprecated`.
101+
102+
103+
.. c:function:: double _Py_c_abs(Py_complex num)
104+
105+
Return the absolute value of the complex number *num*.
106+
107+
Set :c:data:`errno` to :c:macro:`!ERANGE` on overflows.
108+
109+
.. deprecated:: 3.15
110+
This function is :term:`soft deprecated`.
111+
84112
85113
Complex Numbers as Python Objects
86114
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Doc/c-api/long.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,10 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
372372
Set *\*value* to a signed C :c:expr:`int32_t` or :c:expr:`int64_t`
373373
representation of *obj*.
374374
375+
If *obj* is not an instance of :c:type:`PyLongObject`, first call its
376+
:meth:`~object.__index__` method (if present) to convert it to a
377+
:c:type:`PyLongObject`.
378+
375379
If the *obj* value is out of range, raise an :exc:`OverflowError`.
376380
377381
Set *\*value* and return ``0`` on success.

Doc/c-api/object.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ Object Protocol
197197
in favour of using :c:func:`PyObject_DelAttr`, but there are currently no
198198
plans to remove it.
199199
200-
The function must not be called with ``NULL`` *v* and an an exception set.
200+
The function must not be called with a ``NULL`` *v* and an exception set.
201201
This case can arise from forgetting ``NULL`` checks and would delete the
202202
attribute.
203203
@@ -214,7 +214,7 @@ Object Protocol
214214
If *v* is ``NULL``, the attribute is deleted, but this feature is
215215
deprecated in favour of using :c:func:`PyObject_DelAttrString`.
216216
217-
The function must not be called with ``NULL`` *v* and an an exception set.
217+
The function must not be called with a ``NULL`` *v* and an exception set.
218218
This case can arise from forgetting ``NULL`` checks and would delete the
219219
attribute.
220220

Doc/glossary.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,7 @@ Glossary
462462
core and with user code.
463463

464464
f-string
465+
f-strings
465466
String literals prefixed with ``f`` or ``F`` are commonly called
466467
"f-strings" which is short for
467468
:ref:`formatted string literals <f-strings>`. See also :pep:`498`.
@@ -1323,6 +1324,7 @@ Glossary
13231324
See also :term:`borrowed reference`.
13241325

13251326
t-string
1327+
t-strings
13261328
String literals prefixed with ``t`` or ``T`` are commonly called
13271329
"t-strings" which is short for
13281330
:ref:`template string literals <t-strings>`.

Doc/library/ast.rst

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -289,9 +289,9 @@ Literals
289289
* ``conversion`` is an integer:
290290

291291
* -1: no formatting
292-
* 115 (``ord('s')``): ``!s`` string formatting
293-
* 114 (``ord('r')``): ``!r`` repr formatting
294-
* 97 (``ord('a')``): ``!a`` ASCII formatting
292+
* 97 (``ord('a')``): ``!a`` :func:`ASCII <ascii>` formatting
293+
* 114 (``ord('r')``): ``!r`` :func:`repr` formatting
294+
* 115 (``ord('s')``): ``!s`` :func:`string <str>` formatting
295295

296296
* ``format_spec`` is a :class:`JoinedStr` node representing the formatting
297297
of the value, or ``None`` if no format was specified. Both
@@ -325,14 +325,18 @@ Literals
325325
Constant(value='.3')]))]))
326326

327327

328-
.. class:: TemplateStr(values)
328+
.. class:: TemplateStr(values, /)
329329

330-
A t-string, comprising a series of :class:`Interpolation` and :class:`Constant`
331-
nodes.
330+
.. versionadded:: 3.14
331+
332+
Node representing a template string literal, comprising a series of
333+
:class:`Interpolation` and :class:`Constant` nodes.
334+
These nodes may be any order, and do not need to be interleaved.
332335

333336
.. doctest::
334337

335-
>>> print(ast.dump(ast.parse('t"{name} finished {place:ordinal}"', mode='eval'), indent=4))
338+
>>> expr = ast.parse('t"{name} finished {place:ordinal}"', mode='eval')
339+
>>> print(ast.dump(expr, indent=4))
336340
Expression(
337341
body=TemplateStr(
338342
values=[
@@ -349,28 +353,28 @@ Literals
349353
values=[
350354
Constant(value='ordinal')]))]))
351355

352-
.. versionadded:: 3.14
353-
356+
.. class:: Interpolation(value, str, conversion, format_spec=None)
354357

355-
.. class:: Interpolation(value, str, conversion, format_spec)
358+
.. versionadded:: 3.14
356359

357-
Node representing a single interpolation field in a t-string.
360+
Node representing a single interpolation field in a template string literal.
358361

359362
* ``value`` is any expression node (such as a literal, a variable, or a
360363
function call).
364+
This has the same meaning as ``FormattedValue.value``.
361365
* ``str`` is a constant containing the text of the interpolation expression.
362366
* ``conversion`` is an integer:
363367

364368
* -1: no conversion
365-
* 115: ``!s`` string conversion
366-
* 114: ``!r`` repr conversion
367-
* 97: ``!a`` ascii conversion
369+
* 97 (``ord('a')``): ``!a`` :func:`ASCII <ascii>` conversion
370+
* 114 (``ord('r')``): ``!r`` :func:`repr` conversion
371+
* 115 (``ord('s')``): ``!s`` :func:`string <str>` conversion
368372

373+
This has the same meaning as ``FormattedValue.conversion``.
369374
* ``format_spec`` is a :class:`JoinedStr` node representing the formatting
370375
of the value, or ``None`` if no format was specified. Both
371376
``conversion`` and ``format_spec`` can be set at the same time.
372-
373-
.. versionadded:: 3.14
377+
This has the same meaning as ``FormattedValue.format_spec``.
374378

375379

376380
.. class:: List(elts, ctx)

Doc/library/calendar.rst

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,14 @@ The :mod:`calendar` module exports the following data attributes:
501501
>>> list(calendar.month_name)
502502
['', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
503503

504+
.. caution::
505+
506+
In locales with alternative month names forms, the :data:`!month_name` sequence
507+
may not be suitable when a month name stands by itself and not as part of a date.
508+
For instance, in Greek and in many Slavic and Baltic languages, :data:`!month_name`
509+
will produce the month in genitive case. Use :data:`standalone_month_name` for a form
510+
suitable for standalone use.
511+
504512

505513
.. data:: month_abbr
506514

@@ -512,6 +520,31 @@ The :mod:`calendar` module exports the following data attributes:
512520
>>> list(calendar.month_abbr)
513521
['', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
514522

523+
.. caution::
524+
525+
In locales with alternative month names forms, the :data:`!month_abbr` sequence
526+
may not be suitable when a month name stands by itself and not as part of a date.
527+
Use :data:`standalone_month_abbr` for a form suitable for standalone use.
528+
529+
530+
.. data:: standalone_month_name
531+
532+
A sequence that represents the months of the year in the current locale
533+
in the standalone form if the locale provides one. Else it is equivalent
534+
to :data:`month_name`.
535+
536+
.. versionadded:: next
537+
538+
539+
.. data:: standalone_month_abbr
540+
541+
A sequence that represents the abbreviated months of the year in the current
542+
locale in the standalone form if the locale provides one. Else it is
543+
equivalent to :data:`month_abbr`.
544+
545+
.. versionadded:: next
546+
547+
515548
.. data:: JANUARY
516549
FEBRUARY
517550
MARCH

Doc/library/ctypes.rst

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -700,14 +700,10 @@ compiler does it. It is possible to override this behavior entirely by specifyi
700700
:attr:`~Structure._layout_` class attribute in the subclass definition; see
701701
the attribute documentation for details.
702702

703-
It is possible to specify the maximum alignment for the fields by setting
704-
the :attr:`~Structure._pack_` class attribute to a positive integer.
705-
This matches what ``#pragma pack(n)`` does in MSVC.
706-
707-
It is also possible to set a minimum alignment for how the subclass itself is packed in the
708-
same way ``#pragma align(n)`` works in MSVC.
709-
This can be achieved by specifying a :attr:`~Structure._align_` class attribute
710-
in the subclass definition.
703+
It is possible to specify the maximum alignment for the fields and/or for the
704+
structure itself by setting the class attributes :attr:`~Structure._pack_`
705+
and/or :attr:`~Structure._align_`, respectively.
706+
See the attribute documentation for details.
711707

712708
:mod:`ctypes` uses the native byte order for Structures and Unions. To build
713709
structures with non-native byte order, you can use one of the
@@ -2792,11 +2788,18 @@ fields, or any other data types containing pointer type fields.
27922788
.. attribute:: _pack_
27932789

27942790
An optional small integer that allows overriding the alignment of
2795-
structure fields in the instance. :attr:`_pack_` must already be defined
2796-
when :attr:`_fields_` is assigned, otherwise it will have no effect.
2797-
Setting this attribute to 0 is the same as not setting it at all.
2791+
structure fields in the instance.
2792+
2793+
This is only implemented for the MSVC-compatible memory layout
2794+
(see :attr:`_layout_`).
27982795

2799-
This is only implemented for the MSVC-compatible memory layout.
2796+
Setting :attr:`!_pack_` to 0 is the same as not setting it at all.
2797+
Otherwise, the value must be a positive power of two.
2798+
The effect is equivalent to ``#pragma pack(N)`` in C, except
2799+
:mod:`ctypes` may allow larger *n* than what the compiler accepts.
2800+
2801+
:attr:`!_pack_` must already be defined
2802+
when :attr:`_fields_` is assigned, otherwise it will have no effect.
28002803

28012804
.. deprecated-removed:: 3.14 3.19
28022805

@@ -2809,9 +2812,22 @@ fields, or any other data types containing pointer type fields.
28092812

28102813
.. attribute:: _align_
28112814

2812-
An optional small integer that allows overriding the alignment of
2815+
An optional small integer that allows increasing the alignment of
28132816
the structure when being packed or unpacked to/from memory.
2814-
Setting this attribute to 0 is the same as not setting it at all.
2817+
2818+
The value must not be negative.
2819+
The effect is equivalent to ``__attribute__((aligned(N)))`` on GCC
2820+
or ``#pragma align(N)`` on MSVC, except :mod:`ctypes` may allow
2821+
values that the compiler would reject.
2822+
2823+
:attr:`!_align_` can only *increase* a structure's alignment
2824+
requirements. Setting it to 0 or 1 has no effect.
2825+
2826+
Using values that are not powers of two is discouraged and may lead to
2827+
surprising behavior.
2828+
2829+
:attr:`!_align_` must already be defined
2830+
when :attr:`_fields_` is assigned, otherwise it will have no effect.
28152831

28162832
.. versionadded:: 3.13
28172833

Doc/library/dis.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,8 +1122,8 @@ iterations of the loop.
11221122

11231123
.. opcode:: BUILD_TEMPLATE
11241124

1125-
Constructs a new :class:`~string.templatelib.Template` from a tuple
1126-
of strings and a tuple of interpolations and pushes the resulting instance
1125+
Constructs a new :class:`~string.templatelib.Template` instance from a tuple
1126+
of strings and a tuple of interpolations and pushes the resulting object
11271127
onto the stack::
11281128

11291129
interpolations = STACK.pop()
@@ -1135,8 +1135,8 @@ iterations of the loop.
11351135

11361136
.. opcode:: BUILD_INTERPOLATION (format)
11371137

1138-
Constructs a new :class:`~string.templatelib.Interpolation` from a
1139-
value and its source expression and pushes the resulting instance onto the
1138+
Constructs a new :class:`~string.templatelib.Interpolation` instance from a
1139+
value and its source expression and pushes the resulting object onto the
11401140
stack.
11411141

11421142
If no conversion or format specification is present, ``format`` is set to

0 commit comments

Comments
 (0)