Skip to content

Commit 96b4dd1

Browse files
Update Modules/_ctypes/callproc.c
Co-authored-by: neonene <[email protected]>
1 parent 481cf59 commit 96b4dd1

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

Modules/_ctypes/callproc.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1993,13 +1993,14 @@ create_pointer_type(PyObject *module, PyObject *cls)
19931993

19941994
assert(module);
19951995
ctypes_state *st = get_module_state(module);
1996-
StgInfo* info = NULL;
1997-
if (PyStgInfo_FromAny(st, cls, &info) < 0) {
1998-
return NULL;
1999-
}
2000-
2001-
if (info && info->pointer_type) {
2002-
return Py_XNewRef(info->pointer_type);
1996+
StgInfo *info = NULL;
1997+
if (PyType_Check(cls)) {
1998+
if (PyStgInfo_FromType(st, cls, &info) < 0) {
1999+
return NULL;
2000+
}
2001+
if (info && info->pointer_type) {
2002+
return Py_NewRef(info->pointer_type);
2003+
}
20032004
}
20042005

20052006
if (PyDict_GetItemRef(st->_ctypes_ptrtype_cache, cls, &result) != 0) {

0 commit comments

Comments
 (0)