gh-129027: Raise DeprecationWarning for sys._clear_type_cache (#129043)

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>
This commit is contained in:
Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్ రెడ్డి) 2025-04-25 17:31:48 +05:30 committed by GitHub
parent b402a4889b
commit 8783cec9b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 37 additions and 7 deletions

View file

@ -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;
}