Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdbf5e78

Browse files
authored
Merge branch 'main' into fix/itertools-count-repr-126618
2 parentsf8bdf59 +4ae5061 commitdbf5e78

File tree

86 files changed

+1476
-456
lines changed

Some content is hidden

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

86 files changed

+1476
-456
lines changed

‎.github/CODEOWNERS‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,17 @@ configure* @erlend-aasland @corona10
1616
Makefile.pre.in@erlend-aasland
1717
Modules/Setup*@erlend-aasland
1818

19+
# argparse
20+
**/*argparse*@savannahostrowski
21+
1922
# asyncio
2023
**/*asyncio*@1st1@asvetlov@kumaraditya303@willingc
2124

2225
# Core
2326
**/*context*@1st1
2427
**/*genobject*@markshannon
2528
**/*hamt*@1st1
26-
**/*jit*@brandtbucher
29+
**/*jit*@brandtbucher@savannahostrowski
2730
Objects/set*@rhettinger
2831
Objects/dict*@methane@markshannon
2932
Objects/typevarobject.c@JelleZijlstra

‎.github/workflows/build.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
# reproducible: to get the same tools versions (autoconf, aclocal, ...)
4747
runs-on:ubuntu-24.04
4848
container:
49-
image:ghcr.io/python/autoconf:2024.10.16.11360930377
49+
image:ghcr.io/python/autoconf:2024.11.11.11786316759
5050
timeout-minutes:60
5151
needs:check_source
5252
if:needs.check_source.outputs.run_tests == 'true'

‎Doc/c-api/object.rst‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,3 +575,27 @@ Object Protocol
575575
has the:c:macro:`Py_TPFLAGS_MANAGED_DICT` flag set.
576576
577577
..versionadded::3.13
578+
579+
..c:function::intPyUnstable_Object_EnableDeferredRefcount(PyObject *obj)
580+
581+
Enable `deferred reference counting<https://peps.python.org/pep-0703/#deferred-reference-counting>`_ on *obj*,
582+
if supported by the runtime. In the:term:`free-threaded <free threading>` build,
583+
this allows the interpreter to avoid reference count adjustments to *obj*,
584+
which may improve multi-threaded performance. The tradeoff is
585+
that *obj* will only be deallocated by the tracing garbage collector.
586+
587+
This function returns ``1`` if deferred reference counting is enabled on *obj*
588+
(including when it was enabled before the call),
589+
and ``0`` if deferred reference counting is not supported or if the hint was
590+
ignored by the runtime. This function is thread-safe, and cannot fail.
591+
592+
This function does nothing on builds with the :term:`GIL` enabled, which do
593+
not support deferred reference counting. This also does nothing if *obj* is not
594+
an object tracked by the garbage collector (see:func:`gc.is_tracked` and
595+
:c:func:`PyObject_GC_IsTracked`).
596+
597+
This function is intended to be used soon after *obj* is created,
598+
by the code that creates it.
599+
600+
.. versionadded:: next
601+

‎Doc/library/getopt.rst‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,16 @@ exception:
8585
variable:envvar:`!POSIXLY_CORRECT` is set, then option processing stops as
8686
soon as a non-option argument is encountered.
8787

88+
If the first character of the option string is ``'-'``, non-option arguments
89+
that are followed by options are added to the list of option-and-value pairs
90+
as a pair that has ``None`` as its first element and the list of non-option
91+
arguments as its second element.
92+
The second element of the:func:`!gnu_getopt` result is a list of
93+
program arguments after the last option.
94+
95+
..versionchanged::3.14
96+
Support for returning intermixed options and non-option arguments in order.
97+
8898

8999
..exception::GetoptError
90100

@@ -144,6 +154,20 @@ Optional arguments should be specified explicitly:
144154
>>>args
145155
['a1', 'a2']
146156

157+
The order of options and non-option arguments can be preserved:
158+
159+
..doctest::
160+
161+
>>>s='a1 -x a2 a3 a4 --long a5 a6'
162+
>>>args= s.split()
163+
>>>args
164+
['a1', '-x', 'a2', 'a3', 'a4', '--long', 'a5', 'a6']
165+
>>>optlist, args= getopt.gnu_getopt(args,'-x:', ['long='])
166+
>>>optlist
167+
[(None, ['a1']), ('-x', 'a2'), (None, ['a3', 'a4']), ('--long', 'a5')]
168+
>>>args
169+
['a6']
170+
147171
In a script, typical usage is something like this:
148172

149173
..testcode::

‎Doc/library/tomllib.rst‎

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,36 @@ This module defines the following functions:
6060

6161
The following exceptions are available:
6262

63-
..exception::TOMLDecodeError
63+
..exception::TOMLDecodeError(msg, doc, pos)
6464

65-
Subclass of:exc:`ValueError`.
65+
Subclass of:exc:`ValueError` with the following additional attributes:
66+
67+
..attribute::msg
68+
69+
The unformatted error message.
70+
71+
..attribute::doc
72+
73+
The TOML document being parsed.
74+
75+
..attribute::pos
76+
77+
The index of *doc* where parsing failed.
78+
79+
..attribute::lineno
80+
81+
The line corresponding to *pos*.
82+
83+
..attribute::colno
84+
85+
The column corresponding to *pos*.
86+
87+
..versionchanged::next
88+
Added the *msg*, *doc* and *pos* parameters.
89+
Added the:attr:`msg`,:attr:`doc`,:attr:`pos`,:attr:`lineno` and:attr:`colno` attributes.
90+
91+
..deprecated::next
92+
Passing free-form positional arguments is deprecated.
6693

6794

6895
Examples

‎Doc/library/urllib.parse.rst‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,10 @@ or on combining URL components into a URL string.
239239
query parameter separator. This has been changed to allow only a single
240240
separator key, with ``&`` as the default separator.
241241

242+
..deprecated::3.14
243+
Accepting objects with false values (like ``0`` and ``[]``) except empty
244+
strings and byte-like objects and ``None`` is now deprecated.
245+
242246

243247
..function::parse_qsl(qs, keep_blank_values=False, strict_parsing=False, encoding='utf-8', errors='replace', max_num_fields=None, separator='&')
244248

@@ -745,6 +749,10 @@ task isn't already covered by the URL parsing functions above.
745749
..versionchanged::3.5
746750
Added the *quote_via* parameter.
747751

752+
..deprecated::3.14
753+
Accepting objects with false values (like ``0`` and ``[]``) except empty
754+
strings and byte-like objects and ``None`` is now deprecated.
755+
748756

749757
..seealso::
750758

‎Doc/library/uuid.rst‎

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
:mod:`!uuid` --- UUID objects according to:rfc:`4122`
1+
:mod:`!uuid` --- UUID objects according to:rfc:`9562`
22
======================================================
33

44
..module::uuid
5-
:synopsis: UUID objects (universally unique identifiers) according to RFC4122
5+
:synopsis: UUID objects (universally unique identifiers) according to RFC9562
66
..moduleauthor::Ka-Ping Yee <ping@zesty.ca>
77
..sectionauthor::George Yoshida <quiver@users.sourceforge.net>
88

@@ -12,7 +12,8 @@
1212

1313
This module provides immutable:class:`UUID` objects (the:class:`UUID` class)
1414
and the functions:func:`uuid1`,:func:`uuid3`,:func:`uuid4`,:func:`uuid5` for
15-
generating version 1, 3, 4, and 5 UUIDs as specified in:rfc:`4122`.
15+
generating version 1, 3, 4, 5, and 8 UUIDs as specified in:rfc:`9562` (which
16+
supersedes:rfc:`4122`).
1617

1718
If all you want is a unique ID, you should probably call:func:`uuid1` or
1819
:func:`uuid4`. Note that:func:`uuid1` may compromise privacy since it creates
@@ -65,7 +66,7 @@ which relays any information about the UUID's safety, using this enumeration:
6566

6667
Exactly one of *hex*, *bytes*, *bytes_le*, *fields*, or *int* must be given.
6768
The *version* argument is optional; if given, the resulting UUID will have its
68-
variant and version number set according to:rfc:`4122`, overriding bits in the
69+
variant and version number set according to:rfc:`9562`, overriding bits in the
6970
given *hex*, *bytes*, *bytes_le*, *fields*, or *int*.
7071

7172
Comparison of UUID objects are made by way of comparing their
@@ -137,7 +138,7 @@ which relays any information about the UUID's safety, using this enumeration:
137138

138139
..attribute::UUID.urn
139140

140-
The UUID as a URN as specified in:rfc:`4122`.
141+
The UUID as a URN as specified in:rfc:`9562`.
141142

142143

143144
..attribute::UUID.variant
@@ -149,9 +150,13 @@ which relays any information about the UUID's safety, using this enumeration:
149150

150151
..attribute::UUID.version
151152

152-
The UUID version number (1 through5, meaningful only when the variant is
153+
The UUID version number (1 through8, meaningful only when the variant is
153154
:const:`RFC_4122`).
154155

156+
..versionchanged::next
157+
Added UUID version 8.
158+
159+
155160
..attribute::UUID.is_safe
156161

157162
An enumeration of:class:`SafeUUID` which indicates whether the platform
@@ -216,6 +221,23 @@ The :mod:`uuid` module defines the following functions:
216221

217222
..index::single: uuid5
218223

224+
225+
..function::uuid8(a=None, b=None, c=None)
226+
227+
Generate a pseudo-random UUID according to
228+
:rfc:`RFC 9562, §5.8 <9562#section-5.8>`.
229+
230+
When specified, the parameters *a*, *b* and *c* are expected to be
231+
positive integers of 48, 12 and 62 bits respectively. If they exceed
232+
their expected bit count, only their least significant bits are kept;
233+
non-specified arguments are substituted for a pseudo-random integer of
234+
appropriate size.
235+
236+
..versionadded::next
237+
238+
..index::single: uuid8
239+
240+
219241
The:mod:`uuid` module defines the following namespace identifiers for use with
220242
:func:`uuid3` or:func:`uuid5`.
221243

@@ -252,7 +274,9 @@ of the :attr:`~UUID.variant` attribute:
252274

253275
..data::RFC_4122
254276

255-
Specifies the UUID layout given in:rfc:`4122`.
277+
Specifies the UUID layout given in:rfc:`4122`. This constant is kept
278+
for backward compatibility even though:rfc:`4122` has been superseded
279+
by:rfc:`9562`.
256280

257281

258282
..data::RESERVED_MICROSOFT
@@ -267,7 +291,7 @@ of the :attr:`~UUID.variant` attribute:
267291

268292
..seealso::
269293

270-
:rfc:`4122` - A Universally Unique IDentifier (UUID) URN Namespace
294+
:rfc:`9562` - A Universally Unique IDentifier (UUID) URN Namespace
271295
This specification defines a Uniform Resource Name namespace for UUIDs, the
272296
internal format of UUIDs, and methods of generating UUIDs.
273297

@@ -283,7 +307,7 @@ The :mod:`uuid` module can be executed as a script from the command line.
283307

284308
..code-block::sh
285309
286-
python -m uuid [-h] [-u {uuid1,uuid3,uuid4,uuid5}] [-n NAMESPACE] [-N NAME]
310+
python -m uuid [-h] [-u {uuid1,uuid3,uuid4,uuid5,uuid8}] [-n NAMESPACE] [-N NAME]
287311
288312
The following options are accepted:
289313

‎Doc/whatsnew/3.14.rst‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,9 @@ getopt
331331
* Add support for options with optional arguments.
332332
(Contributed by Serhiy Storchaka in:gh:`126374`.)
333333

334+
* Add support for returning intermixed options and non-option arguments in order.
335+
(Contributed by Serhiy Storchaka in:gh:`126390`.)
336+
334337
http
335338
----
336339

@@ -517,6 +520,14 @@ unittest
517520
(Contributed by Jacob Walls in:gh:`80958`.)
518521

519522

523+
uuid
524+
----
525+
526+
* Add support for UUID version 8 via:func:`uuid.uuid8` as specified
527+
in:rfc:`9562`.
528+
(Contributed by Bénédikt Tran in:gh:`89083`.)
529+
530+
520531
.. Add improved modules above alphabetically, not here at the end.
521532
522533
Optimizations
@@ -575,6 +586,13 @@ Deprecated
575586
Deprecate:meth:`symtable.Class.get_methods` due to the lack of interest.
576587
(Contributed by Bénédikt Tran in:gh:`119698`.)
577588

589+
*:mod:`urllib.parse`:
590+
Accepting objects with false values (like ``0`` and ``[]``) except empty
591+
strings, byte-like objects and ``None`` in:mod:`urllib.parse` functions
592+
:func:`~urllib.parse.parse_qsl` and:func:`~urllib.parse.parse_qs` is now
593+
deprecated.
594+
(Contributed by Serhiy Storchaka in:gh:`116897`.)
595+
578596
.. Add deprecations above alphabetically, not here at the end.
579597
580598
..include::../deprecations/pending-removal-in-3.15.rst
@@ -875,6 +893,9 @@ New features
875893
* Add:c:func:`PyType_Freeze` function to make a type immutable.
876894
(Contributed by Victor Stinner in:gh:`121654`.)
877895

896+
* Add:c:func:`PyUnstable_Object_EnableDeferredRefcount` for enabling
897+
deferred reference counting, as outlined in:pep:`703`.
898+
878899
Porting to Python 3.14
879900
----------------------
880901

‎Include/cpython/object.h‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,3 +527,10 @@ typedef enum {
527527
typedefint (*PyRefTracer)(PyObject*,PyRefTracerEventevent,void*);
528528
PyAPI_FUNC(int)PyRefTracer_SetTracer(PyRefTracertracer,void*data);
529529
PyAPI_FUNC(PyRefTracer)PyRefTracer_GetTracer(void**);
530+
531+
/* Enable PEP-703 deferred reference counting on the object.
532+
*
533+
* Returns 1 if deferred reference counting was successfully enabled, and
534+
* 0 if the runtime ignored it. This function cannot fail.
535+
*/
536+
PyAPI_FUNC(int)PyUnstable_Object_EnableDeferredRefcount(PyObject*);

‎Include/internal/pycore_crossinterp.h‎

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,26 @@ typedef int (*xidatafunc)(PyThreadState *tstate, PyObject *, _PyXIData_t *);
100100

101101
typedefstruct_xid_lookup_state_PyXIData_lookup_t;
102102

103-
PyAPI_FUNC(xidatafunc)_PyXIData_Lookup(PyObject*);
104-
PyAPI_FUNC(int)_PyObject_CheckXIData(PyObject*);
105-
PyAPI_FUNC(int)_PyObject_GetXIData(PyObject*,_PyXIData_t*);
103+
typedefstruct {
104+
_PyXIData_lookup_t*global;
105+
_PyXIData_lookup_t*local;
106+
PyObject*PyExc_NotShareableError;
107+
}_PyXIData_lookup_context_t;
108+
109+
PyAPI_FUNC(int)_PyXIData_GetLookupContext(
110+
PyInterpreterState*,
111+
_PyXIData_lookup_context_t*);
112+
113+
PyAPI_FUNC(xidatafunc)_PyXIData_Lookup(
114+
_PyXIData_lookup_context_t*,
115+
PyObject*);
116+
PyAPI_FUNC(int)_PyObject_CheckXIData(
117+
_PyXIData_lookup_context_t*,
118+
PyObject*);
119+
PyAPI_FUNC(int)_PyObject_GetXIData(
120+
_PyXIData_lookup_context_t*,
121+
PyObject*,
122+
_PyXIData_t*);
106123

107124

108125
/* using cross-interpreter data */
@@ -173,12 +190,20 @@ typedef struct {
173190
}exceptions;
174191
}_PyXI_state_t;
175192

193+
#define_PyXI_GET_GLOBAL_STATE(interp) (&(interp)->runtime->xi)
194+
#define_PyXI_GET_STATE(interp) (&(interp)->xi)
195+
196+
#ifndefPy_BUILD_CORE_MODULE
176197
externPyStatus_PyXI_Init(PyInterpreterState*interp);
177198
externvoid_PyXI_Fini(PyInterpreterState*interp);
178199
externPyStatus_PyXI_InitTypes(PyInterpreterState*interp);
179200
externvoid_PyXI_FiniTypes(PyInterpreterState*interp);
201+
#endif// Py_BUILD_CORE_MODULE
180202

181-
#define_PyInterpreterState_GetXIState(interp) (&(interp)->xi)
203+
int_Py_xi_global_state_init(_PyXI_global_state_t*);
204+
void_Py_xi_global_state_fini(_PyXI_global_state_t*);
205+
int_Py_xi_state_init(_PyXI_state_t*,PyInterpreterState*);
206+
void_Py_xi_state_fini(_PyXI_state_t*,PyInterpreterState*);
182207

183208

184209
/***************************/

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp