[3.12] gh-119011: type.__type_params__ now return an empty tuple (GH-119296) (#119681)

(cherry picked from commit 6b240c2308)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
This commit is contained in:
Jelle Zijlstra 2024-05-28 12:54:47 -07:00 committed by GitHub
parent 08636c1a7d
commit 7f06cd335e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 19 additions and 1 deletions

View file

@ -1506,8 +1506,11 @@ type_set_annotations(PyTypeObject *type, PyObject *value, void *context)
static PyObject *
type_get_type_params(PyTypeObject *type, void *context)
{
PyObject *params = PyDict_GetItemWithError(lookup_tp_dict(type), &_Py_ID(__type_params__));
if (type == &PyType_Type) {
return PyTuple_New(0);
}
PyObject *params = PyDict_GetItemWithError(lookup_tp_dict(type), &_Py_ID(__type_params__));
if (params) {
return Py_NewRef(params);
}