From 8783cec9b67b3860bda9496611044b6f310c6761 Mon Sep 17 00:00:00 2001 From: "Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్ రెడ్డి)" Date: Fri, 25 Apr 2025 17:31:48 +0530 Subject: gh-129027: Raise DeprecationWarning for sys._clear_type_cache (#129043) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> --- Python/sysmodule.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'Python') diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 3e0165acd6f..1a7b01bf97f 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -2208,6 +2208,14 @@ static PyObject * sys__clear_type_cache_impl(PyObject *module) /*[clinic end generated code: output=20e48ca54a6f6971 input=127f3e04a8d9b555]*/ { + if (PyErr_WarnEx(PyExc_DeprecationWarning, + "sys._clear_type_cache() is deprecated and" + " scheduled for removal in a future version." + " Use sys._clear_internal_caches() instead.", + 1) < 0) + { + return NULL; + } PyType_ClearCache(); Py_RETURN_NONE; } -- cgit v1.2.3