Skip to content

Commit b1d31a5

Browse files
committed
Merge remote-tracking branch 'upstream/main' into fix-lazy-archive-detection-minimal
2 parents de6b68e + e469fa9 commit b1d31a5

8 files changed

Lines changed: 17 additions & 11 deletions

File tree

Doc/c-api/arg.rst

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -399,13 +399,18 @@ inside nested parentheses. They are:
399399
their default value --- when an optional argument is not specified,
400400
:c:func:`PyArg_ParseTuple` does not touch the contents of the corresponding C
401401
variable(s).
402+
For example, the format string ``"OO|OO"`` corresponds to the Python
403+
signature ``f(a, b, c=None, d=None)``.
402404

403405
``$``
404406
:c:func:`PyArg_ParseTupleAndKeywords` only:
405407
Indicates that the remaining arguments in the Python argument list are
406-
keyword-only. Currently, all keyword-only arguments must also be optional
407-
arguments, so ``|`` must always be specified before ``$`` in the format
408-
string.
408+
keyword-only.
409+
They are optional if ``|`` was specified before ``$``, and required otherwise.
410+
``|`` cannot be specified after ``$``.
411+
For example, the format string ``"O|O$O"`` corresponds to the Python
412+
signature ``f(a, b=None, *, c=None)``,
413+
and the format string ``"OO$OO"`` corresponds to ``f(a, b, *, c, d)``.
409414

410415
.. versionadded:: 3.3
411416

Lib/test/test_bigmem.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -901,7 +901,7 @@ def test_repeat_small(self, size):
901901
def test_repeat_large(self, size):
902902
return self.basic_test_repeat(size)
903903

904-
@bigmemtest(size=_1G - 1, memuse=12)
904+
@bigmemtest(size=_1G - 1, memuse=pointer_size * 3)
905905
def test_repeat_large_2(self, size):
906906
return self.basic_test_repeat(size)
907907

Lib/test/test_hashlib.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -691,12 +691,12 @@ def test_case_md5_2(self):
691691
)
692692

693693
@unittest.skipIf(sys.maxsize < _4G + 5, 'test cannot run on 32-bit systems')
694-
@bigmemtest(size=_4G + 5, memuse=1, dry_run=False)
694+
@bigmemtest(size=_4G + 5, memuse=2, dry_run=False)
695695
def test_case_md5_huge(self, size):
696696
self.check('md5', b'A'*size, 'c9af2dff37468ce5dfee8f2cfc0a9c6d')
697697

698698
@unittest.skipIf(sys.maxsize < _4G - 1, 'test cannot run on 32-bit systems')
699-
@bigmemtest(size=_4G - 1, memuse=1, dry_run=False)
699+
@bigmemtest(size=_4G - 1, memuse=2, dry_run=False)
700700
def test_case_md5_uintmax(self, size):
701701
self.check('md5', b'A'*size, '28138d306ff1b8281f1a9067e1a1a2b3')
702702

Lib/test/test_re.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2251,7 +2251,7 @@ def test_large_search(self, size):
22512251

22522252
# The huge memuse is because of re.sub() using a list and a join()
22532253
# to create the replacement result.
2254-
@bigmemtest(size=_2G, memuse=16 + 2)
2254+
@bigmemtest(size=_2G, memuse=16 + 3)
22552255
def test_large_subn(self, size):
22562256
# Issue #10182: indices were 32-bit-truncated.
22572257
s = 'a' * size

Lib/test/test_tcl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,7 @@ def test_huge_string_call(self, size):
805805

806806
@support.cpython_only
807807
@unittest.skipUnless(INT_MAX < PY_SSIZE_T_MAX, "needs UINT_MAX < SIZE_MAX")
808-
@support.bigmemtest(size=INT_MAX + 1, memuse=2, dry_run=False)
808+
@support.bigmemtest(size=INT_MAX + 1, memuse=3, dry_run=False)
809809
def test_huge_string_builtins(self, size):
810810
tk = self.interp.tk
811811
value = '1' + ' ' * size

Lib/test/test_typing.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9806,6 +9806,7 @@ def test_order_in_union(self):
98069806
for args in itertools.permutations(get_args(expr1)):
98079807
with self.subTest(args=args):
98089808
self.assertEqual(expr1, reduce(operator.or_, args))
9809+
self.assertEqual(expr1, Union[args])
98099810

98109811
expr2 = Union[Annotated[int, 1], str, Annotated[str, {}], int]
98119812
for args in itertools.permutations(get_args(expr2)):

Lib/test/test_zlib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1090,7 +1090,7 @@ def testEOFError(self):
10901090
self.assertRaises(EOFError, zlibd.decompress, b"")
10911091

10921092
@support.skip_if_pgo_task
1093-
@bigmemtest(size=_4G + 100, memuse=3.3)
1093+
@bigmemtest(size=_4G + 100, memuse=4.5)
10941094
def testDecompress4G(self, size):
10951095
# "Test zlib._ZlibDecompressor.decompress() with >4GiB input"
10961096
blocksize = min(10 * 1024 * 1024, size)

Lib/typing.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ def _eval_type(t, globalns, localns, type_params, *, recursive_guard=frozenset()
494494
if isinstance(t, GenericAlias):
495495
return _rebuild_generic_alias(t, ev_args)
496496
if isinstance(t, Union):
497-
return functools.reduce(operator.or_, ev_args)
497+
return Union[ev_args]
498498
else:
499499
return t.copy_with(ev_args)
500500
return t
@@ -2546,7 +2546,7 @@ def _strip_annotations(t):
25462546
stripped_args = tuple(_strip_annotations(a) for a in t.__args__)
25472547
if stripped_args == t.__args__:
25482548
return t
2549-
return functools.reduce(operator.or_, stripped_args)
2549+
return Union[stripped_args]
25502550

25512551
return t
25522552

0 commit comments

Comments
 (0)