Skip to content

Commit e33822d

Browse files
committed
gh-129027: Raise DeprecationWarning for sys._clear_type_cache
1 parent d46b577 commit e33822d

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

Python/clinic/sysmodule.c.h

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/sysmodule.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2122,13 +2122,20 @@ extern PyObject *_Py_GetObjects(PyObject *, PyObject *);
21222122
/*[clinic input]
21232123
sys._clear_type_cache
21242124
2125-
Clear the internal type lookup cache.
2125+
[deprecated] Clear the internal type lookup cache.
2126+
2127+
This function is deprecated and will be removed in future python versions. May we should specify 3.15?
21262128
[clinic start generated code]*/
21272129

21282130
static PyObject *
21292131
sys__clear_type_cache_impl(PyObject *module)
2130-
/*[clinic end generated code: output=20e48ca54a6f6971 input=127f3e04a8d9b555]*/
2132+
/*[clinic end generated code: output=20e48ca54a6f6971 input=d427a1feaacc355c]*/
21312133
{
2134+
if (PyErr_WarnEx(PyExc_DeprecationWarning,
2135+
"sys._clear_type_cache() is deprecated "
2136+
"and will be removed in future python versions", 1) < 0) {
2137+
return NULL;
2138+
}
21322139
PyType_ClearCache();
21332140
Py_RETURN_NONE;
21342141
}

0 commit comments

Comments
 (0)