Skip to content

Commit ee285ae

Browse files
authored
Merge branch 'main' into feature-json-array-hook
2 parents 0eed2fb + 17070f4 commit ee285ae

Some content is hidden

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

50 files changed

+3742
-1824
lines changed

Android/android.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,8 @@ async def gradle_task(context):
628628
# Randomization is disabled because order-dependent failures are
629629
# much less likely to pass on a rerun in single-process mode.
630630
"-m", "test",
631-
f"--{context.ci_mode}-ci", "--single-process", "--no-randomize"
631+
f"--{context.ci_mode}-ci", "--single-process", "--no-randomize",
632+
"--pythoninfo",
632633
]
633634

634635
if not any(arg in context.args for arg in ["-c", "-m"]):

Apple/__main__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -831,6 +831,7 @@ def test(context: argparse.Namespace, host: str | None = None) -> None: # noqa:
831831
f"--{context.ci_mode}-ci",
832832
"--single-process",
833833
"--no-randomize",
834+
"--pythoninfo",
834835
# Timeout handling requires subprocesses; explicitly setting
835836
# the timeout to -1 disables the faulthandler.
836837
"--timeout=-1",

Doc/library/array.rst

Lines changed: 37 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
--------------
1010

1111
This module defines an object type which can compactly represent an array of
12-
basic values: characters, integers, floating-point numbers. Arrays are mutable :term:`sequence`
12+
basic values: characters, integers, floating-point numbers, complex numbers. Arrays are mutable :term:`sequence`
1313
types and behave very much like lists, except that the type of objects stored in
1414
them is constrained. The type is specified at object creation time by using a
1515
:dfn:`type code`, which is a single character. The following type codes are
@@ -46,6 +46,11 @@ defined:
4646
+-----------+--------------------+-------------------+-----------------------+-------+
4747
| ``'d'`` | double | float | 8 | |
4848
+-----------+--------------------+-------------------+-----------------------+-------+
49+
| ``'F'`` | float complex | complex | 8 | \(3) |
50+
+-----------+--------------------+-------------------+-----------------------+-------+
51+
| ``'D'`` | double complex | complex | 16 | \(3) |
52+
+-----------+--------------------+-------------------+-----------------------+-------+
53+
4954

5055
Notes:
5156

@@ -63,6 +68,15 @@ Notes:
6368
(2)
6469
.. versionadded:: 3.13
6570

71+
(3)
72+
Complex types (``F`` and ``D``) are available unconditionally,
73+
regardless on support for complex types (the Annex G of the C11 standard)
74+
by the C compiler.
75+
As specified in the C11 standard, each complex type is represented by a
76+
two-element C array containing, respectively, the real and imaginary parts.
77+
78+
.. versionadded:: 3.15
79+
6680
.. seealso::
6781

6882
The :ref:`ctypes <ctypes-fundamental-data-types>` and
@@ -119,9 +133,9 @@ The module defines the following type:
119133
The length in bytes of one array item in the internal representation.
120134

121135

122-
.. method:: append(x)
136+
.. method:: append(value, /)
123137

124-
Append a new item with value *x* to the end of the array.
138+
Append a new item with the specified value to the end of the array.
125139

126140

127141
.. method:: buffer_info()
@@ -146,25 +160,26 @@ The module defines the following type:
146160
.. method:: byteswap()
147161

148162
"Byteswap" all items of the array. This is only supported for values which are
149-
1, 2, 4, or 8 bytes in size; for other types of values, :exc:`RuntimeError` is
163+
1, 2, 4, 8 or 16 bytes in size; for other types of values, :exc:`RuntimeError` is
150164
raised. It is useful when reading data from a file written on a machine with a
151-
different byte order.
165+
different byte order. Note, that for complex types the order of
166+
components (the real part, followed by imaginary part) is preserved.
152167

153168

154-
.. method:: count(x)
169+
.. method:: count(value, /)
155170

156-
Return the number of occurrences of *x* in the array.
171+
Return the number of occurrences of *value* in the array.
157172

158173

159-
.. method:: extend(iterable)
174+
.. method:: extend(iterable, /)
160175

161176
Append items from *iterable* to the end of the array. If *iterable* is another
162177
array, it must have *exactly* the same type code; if not, :exc:`TypeError` will
163178
be raised. If *iterable* is not an array, it must be iterable and its elements
164179
must be the right type to be appended to the array.
165180

166181

167-
.. method:: frombytes(buffer)
182+
.. method:: frombytes(buffer, /)
168183

169184
Appends items from the :term:`bytes-like object`, interpreting
170185
its content as an array of machine values (as if it had been read
@@ -174,55 +189,55 @@ The module defines the following type:
174189
:meth:`!fromstring` is renamed to :meth:`frombytes` for clarity.
175190

176191

177-
.. method:: fromfile(f, n)
192+
.. method:: fromfile(f, n, /)
178193

179194
Read *n* items (as machine values) from the :term:`file object` *f* and append
180195
them to the end of the array. If less than *n* items are available,
181196
:exc:`EOFError` is raised, but the items that were available are still
182197
inserted into the array.
183198

184199

185-
.. method:: fromlist(list)
200+
.. method:: fromlist(list, /)
186201

187202
Append items from the list. This is equivalent to ``for x in list:
188203
a.append(x)`` except that if there is a type error, the array is unchanged.
189204

190205

191-
.. method:: fromunicode(s)
206+
.. method:: fromunicode(ustr, /)
192207

193208
Extends this array with data from the given Unicode string.
194209
The array must have type code ``'u'`` or ``'w'``; otherwise a :exc:`ValueError` is raised.
195210
Use ``array.frombytes(unicodestring.encode(enc))`` to append Unicode data to an
196211
array of some other type.
197212

198213

199-
.. method:: index(x[, start[, stop]])
214+
.. method:: index(value[, start[, stop]])
200215

201216
Return the smallest *i* such that *i* is the index of the first occurrence of
202-
*x* in the array. The optional arguments *start* and *stop* can be
203-
specified to search for *x* within a subsection of the array. Raise
204-
:exc:`ValueError` if *x* is not found.
217+
*value* in the array. The optional arguments *start* and *stop* can be
218+
specified to search for *value* within a subsection of the array. Raise
219+
:exc:`ValueError` if *value* is not found.
205220

206221
.. versionchanged:: 3.10
207222
Added optional *start* and *stop* parameters.
208223

209224

210-
.. method:: insert(i, x)
225+
.. method:: insert(index, value, /)
211226

212-
Insert a new item with value *x* in the array before position *i*. Negative
227+
Insert a new item *value* in the array before position *index*. Negative
213228
values are treated as being relative to the end of the array.
214229

215230

216-
.. method:: pop([i])
231+
.. method:: pop(index=-1, /)
217232

218233
Removes the item with the index *i* from the array and returns it. The optional
219234
argument defaults to ``-1``, so that by default the last item is removed and
220235
returned.
221236

222237

223-
.. method:: remove(x)
238+
.. method:: remove(value, /)
224239

225-
Remove the first occurrence of *x* from the array.
240+
Remove the first occurrence of *value* from the array.
226241

227242

228243
.. method:: clear()
@@ -247,7 +262,7 @@ The module defines the following type:
247262
:meth:`!tostring` is renamed to :meth:`tobytes` for clarity.
248263

249264

250-
.. method:: tofile(f)
265+
.. method:: tofile(f, /)
251266

252267
Write all items (as machine values) to the :term:`file object` *f*.
253268

Doc/library/collections.rst

Lines changed: 38 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,9 @@ For example::
237237
[('the', 1143), ('and', 966), ('to', 762), ('of', 669), ('i', 631),
238238
('you', 554), ('a', 546), ('my', 514), ('hamlet', 471), ('in', 451)]
239239

240-
.. class:: Counter([iterable-or-mapping])
240+
.. class:: Counter(**kwargs)
241+
Counter(iterable, /, **kwargs)
242+
Counter(mapping, /, **kwargs)
241243
242244
A :class:`Counter` is a :class:`dict` subclass for counting :term:`hashable` objects.
243245
It is a collection where elements are stored as dictionary keys
@@ -287,7 +289,7 @@ For example::
287289
>>> sorted(c.elements())
288290
['a', 'a', 'a', 'a', 'b', 'b']
289291

290-
.. method:: most_common([n])
292+
.. method:: most_common(n=None)
291293

292294
Return a list of the *n* most common elements and their counts from the
293295
most common to the least. If *n* is omitted or ``None``,
@@ -297,7 +299,9 @@ For example::
297299
>>> Counter('abracadabra').most_common(3)
298300
[('a', 5), ('b', 2), ('r', 2)]
299301

300-
.. method:: subtract([iterable-or-mapping])
302+
.. method:: subtract(**kwargs)
303+
subtract(iterable, /, **kwargs)
304+
subtract(mapping, /, **kwargs)
301305
302306
Elements are subtracted from an *iterable* or from another *mapping*
303307
(or counter). Like :meth:`dict.update` but subtracts counts instead
@@ -328,7 +332,9 @@ For example::
328332

329333
This class method is not implemented for :class:`Counter` objects.
330334

331-
.. method:: update([iterable-or-mapping])
335+
.. method:: update(**kwargs)
336+
update(iterable, /, **kwargs)
337+
update(mapping, /, **kwargs)
332338
333339
Elements are counted from an *iterable* or added-in from another
334340
*mapping* (or counter). Like :meth:`dict.update` but adds counts
@@ -481,14 +487,14 @@ or subtracting from an empty counter.
481487

482488
Deque objects support the following methods:
483489

484-
.. method:: append(x)
490+
.. method:: append(item, /)
485491

486-
Add *x* to the right side of the deque.
492+
Add *item* to the right side of the deque.
487493

488494

489-
.. method:: appendleft(x)
495+
.. method:: appendleft(item, /)
490496

491-
Add *x* to the left side of the deque.
497+
Add *item* to the left side of the deque.
492498

493499

494500
.. method:: clear()
@@ -503,38 +509,38 @@ or subtracting from an empty counter.
503509
.. versionadded:: 3.5
504510

505511

506-
.. method:: count(x)
512+
.. method:: count(value, /)
507513

508-
Count the number of deque elements equal to *x*.
514+
Count the number of deque elements equal to *value*.
509515

510516
.. versionadded:: 3.2
511517

512518

513-
.. method:: extend(iterable)
519+
.. method:: extend(iterable, /)
514520

515521
Extend the right side of the deque by appending elements from the iterable
516522
argument.
517523

518524

519-
.. method:: extendleft(iterable)
525+
.. method:: extendleft(iterable, /)
520526

521527
Extend the left side of the deque by appending elements from *iterable*.
522528
Note, the series of left appends results in reversing the order of
523529
elements in the iterable argument.
524530

525531

526-
.. method:: index(x[, start[, stop]])
532+
.. method:: index(value[, start[, stop]])
527533

528-
Return the position of *x* in the deque (at or after index *start*
534+
Return the position of *value* in the deque (at or after index *start*
529535
and before index *stop*). Returns the first match or raises
530536
:exc:`ValueError` if not found.
531537

532538
.. versionadded:: 3.5
533539

534540

535-
.. method:: insert(i, x)
541+
.. method:: insert(index, value, /)
536542

537-
Insert *x* into the deque at position *i*.
543+
Insert *value* into the deque at position *index*.
538544

539545
If the insertion would cause a bounded deque to grow beyond *maxlen*,
540546
an :exc:`IndexError` is raised.
@@ -554,7 +560,7 @@ or subtracting from an empty counter.
554560
elements are present, raises an :exc:`IndexError`.
555561

556562

557-
.. method:: remove(value)
563+
.. method:: remove(value, /)
558564

559565
Remove the first occurrence of *value*. If not found, raises a
560566
:exc:`ValueError`.
@@ -567,7 +573,7 @@ or subtracting from an empty counter.
567573
.. versionadded:: 3.2
568574

569575

570-
.. method:: rotate(n=1)
576+
.. method:: rotate(n=1, /)
571577

572578
Rotate the deque *n* steps to the right. If *n* is negative, rotate
573579
to the left.
@@ -719,7 +725,9 @@ stack manipulations such as ``dup``, ``drop``, ``swap``, ``over``, ``pick``,
719725
:class:`defaultdict` objects
720726
----------------------------
721727

722-
.. class:: defaultdict(default_factory=None, /, [...])
728+
.. class:: defaultdict(default_factory=None, /, **kwargs)
729+
defaultdict(default_factory, mapping, /, **kwargs)
730+
defaultdict(default_factory, iterable, /, **kwargs)
723731
724732
Return a new dictionary-like object. :class:`defaultdict` is a subclass of the
725733
built-in :class:`dict` class. It overrides one method and adds one writable
@@ -735,7 +743,7 @@ stack manipulations such as ``dup``, ``drop``, ``swap``, ``over``, ``pick``,
735743
:class:`defaultdict` objects support the following method in addition to the
736744
standard :class:`dict` operations:
737745

738-
.. method:: __missing__(key)
746+
.. method:: __missing__(key, /)
739747

740748
If the :attr:`default_factory` attribute is ``None``, this raises a
741749
:exc:`KeyError` exception with the *key* as argument.
@@ -941,7 +949,7 @@ In addition to the methods inherited from tuples, named tuples support
941949
three additional methods and two attributes. To prevent conflicts with
942950
field names, the method and attribute names start with an underscore.
943951

944-
.. classmethod:: somenamedtuple._make(iterable)
952+
.. classmethod:: somenamedtuple._make(iterable, /)
945953

946954
Class method that makes a new instance from an existing sequence or iterable.
947955

@@ -1138,7 +1146,9 @@ Some differences from :class:`dict` still remain:
11381146
* Until Python 3.8, :class:`dict` lacked a :meth:`~object.__reversed__` method.
11391147

11401148

1141-
.. class:: OrderedDict([items])
1149+
.. class:: OrderedDict(**kwargs)
1150+
OrderedDict(mapping, /, **kwargs)
1151+
OrderedDict(iterable, /, **kwargs)
11421152
11431153
Return an instance of a :class:`dict` subclass that has methods
11441154
specialized for rearranging dictionary order.
@@ -1319,16 +1329,17 @@ subclass directly from :class:`dict`; however, this class can be easier
13191329
to work with because the underlying dictionary is accessible as an
13201330
attribute.
13211331

1322-
.. class:: UserDict([initialdata])
1332+
.. class:: UserDict(**kwargs)
1333+
UserDict(mapping, /, **kwargs)
1334+
UserDict(iterable, /, **kwargs)
13231335
13241336
Class that simulates a dictionary. The instance's contents are kept in a
13251337
regular dictionary, which is accessible via the :attr:`data` attribute of
1326-
:class:`UserDict` instances. If *initialdata* is provided, :attr:`data` is
1327-
initialized with its contents; note that a reference to *initialdata* will not
1328-
be kept, allowing it to be used for other purposes.
1338+
:class:`!UserDict` instances. If arguments are provided, they are used to
1339+
initialize :attr:`data`, like a regular dictionary.
13291340

13301341
In addition to supporting the methods and operations of mappings,
1331-
:class:`UserDict` instances provide the following attribute:
1342+
:class:`!UserDict` instances provide the following attribute:
13321343

13331344
.. attribute:: data
13341345

Doc/library/signal.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,8 @@ The variables defined in the :mod:`!signal` module are:
230230

231231
Stop executing (cannot be caught or ignored).
232232

233+
.. availability:: Unix.
234+
233235
.. data:: SIGSTKFLT
234236

235237
Stack fault on coprocessor. The Linux kernel does not raise this signal: it

Doc/library/stdtypes.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,13 +1163,13 @@ Sequence types also support the following methods:
11631163

11641164
Return the total number of occurrences of *value* in *sequence*.
11651165

1166-
.. method:: list.index(value[, start[, stop])
1167-
range.index(value[, start[, stop])
1168-
tuple.index(value[, start[, stop])
1166+
.. method:: list.index(value[, start[, stop]])
1167+
range.index(value[, start[, stop]])
1168+
tuple.index(value[, start[, stop]])
11691169
:no-contents-entry:
11701170
:no-index-entry:
11711171
:no-typesetting:
1172-
.. method:: sequence.index(value[, start[, stop])
1172+
.. method:: sequence.index(value[, start[, stop]])
11731173

11741174
Return the index of the first occurrence of *value* in *sequence*.
11751175

0 commit comments

Comments
 (0)