Skip to content

Commit 6174e6d

Browse files
authored
Sync capsule import fix from mypy (#9)
See python/mypy#20014
1 parent a6ab71c commit 6174e6d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib-rt/librt_internal.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ static void **NativeInternal_API;
4242
static int
4343
import_librt_internal(void)
4444
{
45+
PyObject *mod = PyImport_ImportModule("librt.internal");
46+
if (mod == NULL)
47+
return -1;
48+
Py_DECREF(mod); // we import just for the side effect of making the below work.
4549
NativeInternal_API = (void **)PyCapsule_Import("librt.internal._C_API", 0);
4650
if (NativeInternal_API == NULL)
4751
return -1;

0 commit comments

Comments
 (0)