8000 It is better to check local cache first · python/cpython@481cf59 · GitHub
[go: up one dir, main page]

Skip to content

Commit 481cf59

Browse files
It is better to check local cache first
1 parent f96ae59 commit 481cf59

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Modules/_ctypes/callproc.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1993,11 +1993,6 @@ create_pointer_type(PyObject *module, PyObject *cls)
19931993

19941994
assert(module);
19951995
ctypes_state *st = get_module_state(module);
1996-
if (PyDict_GetItemRef(st->_ctypes_ptrtype_cache, cls, &result) != 0) {
1997-
// found or error
1998-
return result;
1999-
}
2000-
20011996
StgInfo* info = NULL;
20021997
if (PyStgInfo_FromAny(st, cls, &info) < 0) {
20031998
return NULL;
@@ -2007,6 +2002,11 @@ create_pointer_type(PyObject *module, PyObject *cls)
20072002
return Py_XNewRef(info->pointer_type);
20082003
}
20092004

2005+
if (PyDict_GetItemRef(st->_ctypes_ptrtype_cache, cls, &result) != 0) {
2006+
// found or error
2007+
return result;
2008+
}
2009+
20102010
// not found
20112011
if (PyUnicode_CheckExact(cls)) {
20122012
PyObject *name = PyUnicode_FromFormat("LP_%U", cls);

0 commit comments

Comments
 (0)
0