Skip to content

Commit 6c1c527

Browse files
committed
Make capsule import work
1 parent d6d75a5 commit 6c1c527

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

mypyc/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)