Skip to content

Commit 85fb30a

Browse files
generatedunixname1734921407115435meta-codesync[bot]
authored andcommitted
Sync pre-release CPython main branch from GitHub (2026-08-22)
Summary: Imported python/cpython `3.16.0a0` from upstream rev [`b062727`](https://www.github.com/python/cpython/commit/b062727097e997bcb900e11503d3248daac903da) (committed 2026-08-22 18:45:59+00:00). # Commit Info - Base: (`3.16.0a0`) - [`918fb3a`](https://www.github.com/python/cpython/commit/918fb3aec907baf8d9b6181570ff308529be16a3) (commit date: 2026-08-22 03:51:49+00:00) - Imported: (`3.16.0a0`) - [`b062727`](https://www.github.com/python/cpython/commit/b062727097e997bcb900e11503d3248daac903da) (commit date: 2026-08-22 18:45:59+00:00) # Noteworthy file changes - Low-signal files (3 added) (NEWS.d, docs, .github) Complete list of added/removed files: https://www.internalfb.com/intern/everpaste/?color=0&handle=GJWGnSd-OwxZ3PIPAISkJ09wVXI-br0LAAAz Differential Revision: D117103803 fbshipit-source-id: bdc8d465325b49d07dcecec5ae4d9c1daa784af1
1 parent 90cd6a1 commit 85fb30a

13 files changed

Lines changed: 119 additions & 8 deletions

.github/CODEOWNERS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,12 @@ Lib/test/test_unittest/testmock/ @cjw296
620620
# Weakref
621621
**/*weakref* @kumaraditya303
622622

623+
# Zlib
624+
Doc/library/zlib.rst @StanFromIreland
625+
Lib/compression/zlib.py @StanFromIreland
626+
Lib/test/test_zlib.py @StanFromIreland
627+
Modules/_zlibmodule.c @StanFromIreland
628+
623629
# Zipfile.Path
624630
Lib/test/test_zipfile/_path/ @jaraco
625631
Lib/zipfile/_path/ @jaraco

Doc/glossary.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ Glossary
509509
A piece of syntax which can be evaluated to some value. In other words,
510510
an expression is an accumulation of expression elements like literals,
511511
names, attribute access, operators or function calls which all return a
512-
value. In contrast to many other languages, not all language constructs
512+
value. Not all language constructs
513513
are expressions. There are also :term:`statement`\s which cannot be used
514514
as expressions, such as :keyword:`while`. Assignments are also statements,
515515
not expressions.

Lib/test/test_clinic.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4981,6 +4981,18 @@ def test_kwds_with_pos_only(self):
49814981
self.assertEqual(ac_tester.kwds_with_pos_only(1, 2, y='y', z='z'), (1, 2, kwds))
49824982
self.assertEqual(ac_tester.kwds_with_pos_only(1, 2, **kwds), (1, 2, kwds))
49834983

4984+
def test_kwds_with_optional_pos_only(self):
4985+
with self.assertRaises(TypeError):
4986+
ac_tester.kwds_with_optional_pos_only()
4987+
with self.assertRaises(TypeError):
4988+
ac_tester.kwds_with_optional_pos_only(y='y')
4989+
self.assertEqual(ac_tester.kwds_with_optional_pos_only(1), (1, None, {}))
4990+
self.assertEqual(ac_tester.kwds_with_optional_pos_only(1, 2), (1, 2, {}))
4991+
self.assertEqual(ac_tester.kwds_with_optional_pos_only(1, y='y'),
4992+
(1, None, {'y': 'y'}))
4993+
self.assertEqual(ac_tester.kwds_with_optional_pos_only(1, 2, y='y'),
4994+
(1, 2, {'y': 'y'}))
4995+
49844996
def test_kwds_with_stararg(self):
49854997
self.assertEqual(ac_tester.kwds_with_stararg(), ((), {}))
49864998
self.assertEqual(ac_tester.kwds_with_stararg(1, 2), ((1, 2), {}))

Lib/test/test_zlib.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,9 @@ def test_combine_no_iv_invalid_length(self):
182182
self.assertNotEqual(invalid_res, checksum)
183183

184184
self.assertRaises(TypeError, self.combine, 0, 0, "len")
185+
self.assertRaises(ValueError, self.combine, 0, 0, -1)
186+
self.assertRaises(OverflowError, self.combine, 0, 0, 2**1000)
187+
self.assertRaises(OverflowError, self.combine, 0, 0, -2**1000)
185188

186189
def test_combine_with_iv(self):
187190
for _ in range(self.N):
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix curses detection with libraries in ``LIBS`` and
2+
:option:`--without-curses`. Patch by Shamil Abdulaev.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
:func:`zlib.adler32_combine` and :func:`zlib.crc32_combine` now raise
2+
:exc:`ValueError` if the *len2* argument is negative, instead of returning
3+
rubbish or hanging indefinitely, respectively.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix Argument Clinic generating code which reads an optional positional
2+
argument which was not passed, if the function has a ``**kwds`` parameter.

Modules/_testclinic.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2474,6 +2474,23 @@ kwds_with_pos_only_impl(PyObject *module, PyObject *a, PyObject *b,
24742474
}
24752475

24762476

2477+
/*[clinic input]
2478+
kwds_with_optional_pos_only
2479+
a: object
2480+
b: object = None
2481+
/
2482+
**kwds: dict
2483+
[clinic start generated code]*/
2484+
2485+
static PyObject *
2486+
kwds_with_optional_pos_only_impl(PyObject *module, PyObject *a, PyObject *b,
2487+
PyObject *kwds)
2488+
/*[clinic end generated code: output=25a8458f5acc1a07 input=0b18b9e1670904ec]*/
2489+
{
2490+
return pack_arguments_newref(3, a, b, kwds);
2491+
}
2492+
2493+
24772494
/*[clinic input]
24782495
kwds_with_stararg
24792496
*args: tuple
@@ -2611,6 +2628,7 @@ static PyMethodDef tester_methods[] = {
26112628

26122629
LONE_KWDS_METHODDEF
26132630
KWDS_WITH_POS_ONLY_METHODDEF
2631+
KWDS_WITH_OPTIONAL_POS_ONLY_METHODDEF
26142632
KWDS_WITH_STARARG_METHODDEF
26152633
KWDS_WITH_POS_ONLY_AND_STARARG_METHODDEF
26162634

Modules/clinic/_testclinic_kwds.c.h

Lines changed: 48 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/zlibmodule.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1948,7 +1948,10 @@ zlib_adler32_combine_impl(PyObject *module, unsigned int adler1,
19481948
#else
19491949
z_off_t len = convert_to_z_off_t(len2);
19501950
#endif
1951-
if (PyErr_Occurred()) {
1951+
if (len < 0) {
1952+
if (!PyErr_Occurred()) {
1953+
PyErr_SetString(PyExc_ValueError, "len2 must be non-negative");
1954+
}
19521955
return (unsigned int)-1;
19531956
}
19541957
return adler32_combine(adler1, adler2, len);
@@ -2033,7 +2036,10 @@ zlib_crc32_combine_impl(PyObject *module, unsigned int crc1,
20332036
#else
20342037
z_off_t len = convert_to_z_off_t(len2);
20352038
#endif
2036-
if (PyErr_Occurred()) {
2039+
if (len < 0) {
2040+
if (!PyErr_Occurred()) {
2041+
PyErr_SetString(PyExc_ValueError, "len2 must be non-negative");
2042+
}
20372043
return (unsigned int)-1;
20382044
}
20392045
return crc32_combine(crc1, crc2, len);

0 commit comments

Comments
 (0)