Skip to content

Commit 2bf2a36

Browse files
committed
Refactor 'import.c'.
1 parent f0854a8 commit 2bf2a36

File tree

1 file changed

+2
-12
lines changed
  • graalpython/com.oracle.graal.python.cext/src

1 file changed

+2
-12
lines changed

graalpython/com.oracle.graal.python.cext/src/import.c

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,9 @@
3939
#include "capi.h"
4040

4141
PyObject* PyImport_ImportModule(const char *name) {
42-
void* result = polyglot_invoke(PY_TRUFFLE_CEXT, "PyImport_ImportModule", polyglot_from_string(name, "utf-8"));
43-
if (result == ERROR_MARKER) {
44-
return NULL;
45-
} else {
46-
return to_sulong(result);
47-
}
42+
return polyglot_as_PyModuleObject(UPCALL_CEXT_O("PyImport_ImportModule", polyglot_from_string(name, SRC_CS)));
4843
}
4944

5045
PyObject* PyImport_GetModuleDict() {
51-
void* result = polyglot_invoke(PY_TRUFFLE_CEXT, "PyImport_GetModuleDict");
52-
if (result == ERROR_MARKER) {
53-
return NULL;
54-
} else {
55-
return to_sulong(result);
56-
}
46+
return UPCALL_CEXT_O("PyImport_GetModuleDict");
5747
}

0 commit comments

Comments
 (0)