Skip to content

Commit 68cff41

Browse files
Merge branch '3.14' into issue-139951-tuple-track-tests-3.14
2 parents bbe2b5c + 52338ec commit 68cff41

File tree

5 files changed

+9
-1
lines changed

5 files changed

+9
-1
lines changed

Doc/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,7 @@
359359
'papersize': 'a4paper',
360360
# The font size ('10pt', '11pt' or '12pt').
361361
'pointsize': '10pt',
362+
'maxlistdepth': '8', # See https://github.com/python/cpython/issues/139588
362363
}
363364

364365
# Grouping the document tree into LaTeX files. List of tuples

Lib/test/test_functools.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,13 +406,16 @@ def test_setstate(self):
406406

407407
def test_setstate_errors(self):
408408
f = self.partial(signature)
409+
409410
self.assertRaises(TypeError, f.__setstate__, (capture, (), {}))
410411
self.assertRaises(TypeError, f.__setstate__, (capture, (), {}, {}, None))
411412
self.assertRaises(TypeError, f.__setstate__, [capture, (), {}, None])
412413
self.assertRaises(TypeError, f.__setstate__, (None, (), {}, None))
413414
self.assertRaises(TypeError, f.__setstate__, (capture, None, {}, None))
414415
self.assertRaises(TypeError, f.__setstate__, (capture, [], {}, None))
415416
self.assertRaises(TypeError, f.__setstate__, (capture, (), [], None))
417+
self.assertRaises(TypeError, f.__setstate__, (capture, (), {}, ()))
418+
self.assertRaises(TypeError, f.__setstate__, (capture, (), {}, 'test'))
416419

417420
def test_setstate_subclasses(self):
418421
f = self.partial(signature)

Lib/test/test_import/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3160,6 +3160,7 @@ def test_check_state_first(self):
31603160
# Also, we test with a single-phase module that has global state,
31613161
# which is shared by all interpreters.
31623162

3163+
@no_rerun(reason="module state is not cleared (see gh-140657)")
31633164
@requires_subinterpreters
31643165
def test_basic_multiple_interpreters_main_no_reset(self):
31653166
# without resetting; already loaded in main interpreter
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix arguments checking for the :meth:`!functools.partial.__setstate__` that
2+
may lead to internal state corruption and crash. Patch by Sergey Miryanov.

Modules/_functoolsmodule.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,8 @@ partial_setstate(PyObject *self, PyObject *state)
699699
if (!PyArg_ParseTuple(state, "OOOO", &fn, &fnargs, &kw, &dict) ||
700700
!PyCallable_Check(fn) ||
701701
!PyTuple_Check(fnargs) ||
702-
(kw != Py_None && !PyDict_Check(kw)))
702+
(kw != Py_None && !PyDict_Check(kw)) ||
703+
(dict != Py_None && !PyDict_Check(dict)))
703704
{
704705
PyErr_SetString(PyExc_TypeError, "invalid partial state");
705706
return NULL;

0 commit comments

Comments
 (0)