8383import com .oracle .graal .python .builtins .objects .PythonAbstractObject ;
8484import com .oracle .graal .python .builtins .objects .capsule .PyCapsule ;
8585import com .oracle .graal .python .builtins .objects .cext .capi .CExtNodes .PCallCapiFunction ;
86- import com .oracle .graal .python .builtins .objects .cext .capi .CExtNodesFactory .CreateModuleNodeGen ;
8786import com .oracle .graal .python .builtins .objects .cext .capi .PythonNativeWrapper .PythonAbstractObjectNativeWrapper ;
8887import com .oracle .graal .python .builtins .objects .cext .capi .transitions .CApiTransitions ;
8988import com .oracle .graal .python .builtins .objects .cext .capi .transitions .CApiTransitions .HandleContext ;
9089import com .oracle .graal .python .builtins .objects .cext .capi .transitions .CApiTransitions .NativeToPythonNode ;
9190import com .oracle .graal .python .builtins .objects .cext .capi .transitions .CApiTransitions .ToPythonWrapperNode ;
9291import com .oracle .graal .python .builtins .objects .cext .common .CExtCommonNodes ;
93- import com .oracle .graal .python .builtins .objects .cext .common .CExtCommonNodes .CheckFunctionResultNode ;
9492import com .oracle .graal .python .builtins .objects .cext .common .CExtCommonNodes .EnsureExecutableNode ;
9593import com .oracle .graal .python .builtins .objects .cext .common .CExtContext ;
9694import com .oracle .graal .python .builtins .objects .cext .common .LoadCExtException .ApiInitException ;
@@ -1074,16 +1072,13 @@ private static String dlopenFlagsToString(int flags) {
10741072 * @param context The Python context object.
10751073 * @param spec The name and path of the module (also containing the original module spec
10761074 * object).
1077- * @param checkFunctionResultNode A node to check that the function result does not indicate
1078- * that an exception was raised on the native side. It should be an adopted node,
1079- * because only an adopted node will report useful source locations.
10801075 * @return A Python module.
10811076 * @throws IOException If the specified file cannot be loaded.
10821077 * @throws ApiInitException If the corresponding native context could not be initialized.
10831078 * @throws ImportException If an exception occurred during C extension initialization.
10841079 */
10851080 @ TruffleBoundary
1086- public static Object loadCExtModule (Node location , PythonContext context , ModuleSpec spec , CheckFunctionResultNode checkFunctionResultNode )
1081+ public static Object loadCExtModule (Node location , PythonContext context , ModuleSpec spec )
10871082 throws IOException , ApiInitException , ImportException {
10881083 if (getLogger (CApiContext .class ).isLoggable (Level .WARNING ) && context .getOption (PythonOptions .WarnExperimentalFeatures )) {
10891084 if (!C_EXT_SUPPORTED_LIST .contains (spec .name .toJavaStringUncached ())) {
@@ -1142,7 +1137,7 @@ public static Object loadCExtModule(Node location, PythonContext context, Module
11421137 }
11431138
11441139 try {
1145- return cApiContext .initCApiModule (location , library , spec .getInitFunctionName (), spec , interopLib , checkFunctionResultNode );
1140+ return cApiContext .initCApiModule (location , library , spec .getInitFunctionName (), spec , interopLib );
11461141 } catch (UnsupportedTypeException | ArityException | UnsupportedMessageException e ) {
11471142 throw new ImportException (CExtContext .wrapJavaException (e , location ), spec .name , spec .path , ErrorMessages .CANNOT_INITIALIZE_WITH , spec .path , spec .getEncodedName (), "" );
11481143 }
@@ -1283,7 +1278,7 @@ public void finalizeCApi() {
12831278 }
12841279
12851280 @ TruffleBoundary
1286- public Object initCApiModule (Node location , Object sharedLibrary , TruffleString initFuncName , ModuleSpec spec , InteropLibrary llvmInteropLib , CheckFunctionResultNode checkFunctionResultNode )
1281+ public Object initCApiModule (Node node , Object sharedLibrary , TruffleString initFuncName , ModuleSpec spec , InteropLibrary llvmInteropLib )
12871282 throws UnsupportedMessageException , ArityException , UnsupportedTypeException , ImportException {
12881283 PythonContext context = getContext ();
12891284 CApiContext cApiContext = context .getCApiContext ();
@@ -1307,7 +1302,7 @@ public Object initCApiModule(Node location, Object sharedLibrary, TruffleString
13071302 nativeResult = InteropLibrary .getUncached ().execute (pyinitFunc , arguments );
13081303 }
13091304
1310- checkFunctionResultNode .execute (context , initFuncName , nativeResult );
1305+ ExternalFunctionNodesFactory . DefaultCheckFunctionResultNodeGen . getUncached () .execute (context , initFuncName , nativeResult );
13111306
13121307 Object result = NativeToPythonNode .executeUncached (nativeResult );
13131308 if (!(result instanceof PythonModule )) {
@@ -1322,10 +1317,10 @@ public Object initCApiModule(Node location, Object sharedLibrary, TruffleString
13221317 */
13231318 Object clazz = GetClassNode .executeUncached (result );
13241319 if (clazz == PNone .NO_VALUE ) {
1325- throw PRaiseNode .raiseStatic (location , PythonBuiltinClassType .SystemError , ErrorMessages .INIT_FUNC_RETURNED_UNINT_OBJ , initFuncName );
1320+ throw PRaiseNode .raiseStatic (node , PythonBuiltinClassType .SystemError , ErrorMessages .INIT_FUNC_RETURNED_UNINT_OBJ , initFuncName );
13261321 }
13271322
1328- return CreateModuleNodeGen . getUncached (). execute ( cApiContext , spec , result , sharedLibrary );
1323+ return CExtNodes . createModule ( node , cApiContext , spec , result , sharedLibrary );
13291324 } else {
13301325 // see: 'import.c: _PyImport_FixupExtensionObject'
13311326 PythonModule module = (PythonModule ) result ;
0 commit comments