Skip to content

Commit da68d69

Browse files
committed
fix PyCapsule_Import with no_block==1
1 parent eafb18e commit da68d69

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/cext/PythonCextCapsuleBuiltins.java

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ Object doError(@SuppressWarnings("unused") Object o, @SuppressWarnings("unused")
315315
@CApiBuiltin(ret = Pointer, args = {ConstCharPtrAsTruffleString, Int}, call = Direct)
316316
abstract static class PyCapsule_Import extends CApiBinaryBuiltinNode {
317317
@Specialization
318-
Object doGeneric(TruffleString name, int noBlock,
318+
Object doGeneric(TruffleString name, @SuppressWarnings("unused") int noBlock,
319319
@Cached PyCapsuleNameMatchesNode nameMatchesNode,
320320
@Cached TruffleString.CodePointLengthNode codePointLengthNode,
321321
@Cached TruffleString.IndexOfStringNode indexOfStringNode,
@@ -332,14 +332,10 @@ Object doGeneric(TruffleString name, int noBlock,
332332
trace = substringNode.execute(trace, 0, dotIdx, TS_ENCODING, false);
333333
}
334334
if (object == null) {
335-
if (noBlock == 1) {
336-
// object = PyImport_ImportModuleNoBlock(trace);
337-
throw raise(SystemError, NOT_IMPLEMENTED);
338-
} else {
339-
object = AbstractImportNode.importModule(trace, T_IMPORT_ALL);
340-
if (object == PNone.NO_VALUE) {
341-
throw raise(ImportError, PY_CAPSULE_IMPORT_S_IS_NOT_VALID, trace);
342-
}
335+
// noBlock has no effect anymore since 3.3
336+
object = AbstractImportNode.importModule(trace, T_IMPORT_ALL);
337+
if (object == PNone.NO_VALUE) {
338+
throw raise(ImportError, PY_CAPSULE_IMPORT_S_IS_NOT_VALID, trace);
343339
}
344340
} else {
345341
object = getAttrNode.execute(object, trace);

0 commit comments

Comments
 (0)