8000 fix · python/cpython@2953fb4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2953fb4

Browse files
committed
fix
1 parent 9dd7103 commit 2953fb4

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Objects/typeobject.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5723,6 +5723,9 @@ _PyType_GetItemFromCache(PyTypeObject *type)
57235723
BEGIN_TYPE_LOCK();
57245724
PyHeapTypeObject *ht = (PyHeapTypeObject *)type;
57255725
res = ht->_spec_cache.getitem;
5726+
if (res == NULL || !PyFunction_Check(res)) {
5727+
res = NULL;
5728+
}
57265729
END_TYPE_LOCK();
57275730
return res;
57285731
}
@@ -5737,6 +5740,10 @@ _PyType_GetItemFromCacheWithVersion(PyTypeObject *type, uint32_t *version)
57375740
if (res == NULL) {
57385741
goto end;
57395742
}
5743+
if (!PyFunction_Check(res)) {
5744+
res = NULL;
5745+
goto end;
5746+
}
57405747
*version = ht->_spec_cache.getitem_version;
57415748
end:
57425749
END_TYPE_LOCK();

0 commit comments

Comments
 (0)
0