From 5f91d5d9a4187c4bfa2ddd653b819b12eb3ad477 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Sun, 12 Oct 2025 19:32:10 +0200 Subject: [PATCH 1/2] gh-112075: Remove _PyObject_SetManagedDict() function (#139737) Move it to the internal C API and no longer export it. --- Include/cpython/object.h | 1 - Include/internal/pycore_object.h | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Include/cpython/object.h b/Include/cpython/object.h index e2f87524c218b63..d64298232e705c8 100644 --- a/Include/cpython/object.h +++ b/Include/cpython/object.h @@ -442,7 +442,6 @@ PyAPI_FUNC(int) _Py_ReachedRecursionLimitWithMargin(PyThreadState *tstate, int m PyAPI_FUNC(void *) PyObject_GetItemData(PyObject *obj); PyAPI_FUNC(int) PyObject_VisitManagedDict(PyObject *obj, visitproc visit, void *arg); -PyAPI_FUNC(int) _PyObject_SetManagedDict(PyObject *obj, PyObject *new_dict); PyAPI_FUNC(void) PyObject_ClearManagedDict(PyObject *obj); diff --git a/Include/internal/pycore_object.h b/Include/internal/pycore_object.h index 77560e5da66b03c..980d6d7764bd2cd 100644 --- a/Include/internal/pycore_object.h +++ b/Include/internal/pycore_object.h @@ -1031,7 +1031,8 @@ enum _PyAnnotateFormat { _Py_ANNOTATE_FORMAT_STRING = 4, }; -int _PyObject_SetDict(PyObject *obj, PyObject *value); +extern int _PyObject_SetDict(PyObject *obj, PyObject *value); +extern int _PyObject_SetManagedDict(PyObject *obj, PyObject *new_dict); #ifndef Py_GIL_DISABLED static inline Py_ALWAYS_INLINE void _Py_INCREF_MORTAL(PyObject *op) From bb85af343f331b104e3bca685e8f96e60bba8bc0 Mon Sep 17 00:00:00 2001 From: Arseniy Krupchik <96835169+Grivvus@users.noreply.github.com> Date: Mon, 13 Oct 2025 02:17:41 +0400 Subject: [PATCH 2/2] gh-136438: Make sure test.test_pydoc.test_pydoc pass with all optimization levels (#136479) test_pydoc.test_pydoc now passes with -OO --- Lib/test/test_pydoc/test_pydoc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_pydoc/test_pydoc.py b/Lib/test/test_pydoc/test_pydoc.py index 5aa8d92057e3d70..c640416327efbff 100644 --- a/Lib/test/test_pydoc/test_pydoc.py +++ b/Lib/test/test_pydoc/test_pydoc.py @@ -1413,7 +1413,7 @@ def test_special_form(self): self.assertIn('NoReturn = typing.NoReturn', doc) self.assertIn(typing.NoReturn.__doc__.strip().splitlines()[0], doc) else: - self.assertIn('NoReturn = class _SpecialForm(_Final)', doc) + self.assertIn('NoReturn = class _SpecialForm(_Final, _NotIterable)', doc) def test_typing_pydoc(self): def foo(data: typing.List[typing.Any],