Skip to content

Commit e2a23fe

Browse files
authored
Remove usused "FetchCommonPointer" utility code (cythonGH-4380)
1 parent aea4e6b commit e2a23fe

File tree

2 files changed

+0
-35
lines changed

2 files changed

+0
-35
lines changed

Cython/Utility/CommonStructures.c

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -125,36 +125,3 @@ static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec
125125
}
126126
#endif
127127

128-
129-
/////////////// FetchCommonPointer.proto ///////////////
130-
131-
static void* __Pyx_FetchCommonPointer(void* pointer, const char* name);
132-
133-
/////////////// FetchCommonPointer ///////////////
134-
135-
136-
static void* __Pyx_FetchCommonPointer(void* pointer, const char* name) {
137-
PyObject* abi_module = NULL;
138-
PyObject* capsule = NULL;
139-
void* value = NULL;
140-
141-
abi_module = PyImport_AddModule((char*) __PYX_ABI_MODULE_NAME);
142-
if (!abi_module) return NULL;
143-
Py_INCREF(abi_module);
144-
145-
capsule = PyObject_GetAttrString(abi_module, name);
146-
if (!capsule) {
147-
if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
148-
PyErr_Clear();
149-
capsule = PyCapsule_New(pointer, name, NULL);
150-
if (!capsule) goto bad;
151-
if (PyObject_SetAttrString(abi_module, name, capsule) < 0)
152-
goto bad;
153-
}
154-
value = PyCapsule_GetPointer(capsule, name);
155-
156-
bad:
157-
Py_XDECREF(capsule);
158-
Py_DECREF(abi_module);
159-
return value;
160-
}

Cython/Utility/ModuleSetupCode.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1678,7 +1678,6 @@ static void __Pyx_FastGilFuncInit(void);
16781678
#endif
16791679

16801680
/////////////// FastGil ///////////////
1681-
//@requires: CommonStructures.c::FetchCommonPointer
16821681
// The implementations of PyGILState_Ensure/Release calls PyThread_get_key_value
16831682
// several times which is turns out to be quite slow (slower in fact than
16841683
// acquiring the GIL itself). Simply storing it in a thread local for the
@@ -1780,7 +1779,6 @@ static void __Pyx_FastGilFuncInit0(void) {
17801779
#else
17811780

17821781
static void __Pyx_FastGilFuncInit0(void) {
1783-
CYTHON_UNUSED_VAR(&__Pyx_FetchCommonPointer);
17841782
}
17851783

17861784
#endif

0 commit comments

Comments
 (0)