Skip to content

Commit 14200a0

Browse files
committed
Fix C extensions list
1 parent 52c1521 commit 14200a0

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/ImpModuleBuiltins.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -315,20 +315,20 @@ Object run(VirtualFrame frame, PythonObject moduleSpec, @SuppressWarnings("unuse
315315

316316
@TruffleBoundary
317317
private Object run(PythonContext context, ModuleSpec spec) throws IOException, ApiInitException, ImportException {
318-
Object existingModule = findExtension(context, spec);
318+
PythonModule existingModule = findExtension(context, spec);
319319
if (existingModule != null) {
320320
return existingModule;
321321
}
322322
return CExtContext.loadCExtModule(this, context, spec, getCheckResultNode());
323323
}
324324

325-
private Object findExtension(PythonContext context, ModuleSpec spec) {
326-
// TODO check m_size
327-
// TODO populate m_copy
325+
private PythonModule findExtension(PythonContext context, ModuleSpec spec) {
328326
CApiContext cApiContext = context.getCApiContext();
329327
if (cApiContext == null) {
330328
return null;
331329
}
330+
// TODO check m_size
331+
// TODO populate m_copy?
332332
return cApiContext.findExtension(spec.path, spec.name);
333333
}
334334

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/capi/CApiContext.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ public final class CApiContext extends CExtContext {
180180
private Object nativeSmallIntsArray;
181181

182182
/** Same as {@code import.c: extensions} but we don't keep a PDict; just a bare Java HashMap. */
183-
private final HashMap<Pair<TruffleString, TruffleString>, Object> extensions = new HashMap<>(4);
183+
private final HashMap<Pair<TruffleString, TruffleString>, PythonModule> extensions = new HashMap<>(4);
184184

185185
/** corresponds to {@code unicodeobject.c: interned} */
186186
private PDict internedUnicode;
@@ -812,13 +812,13 @@ public Object initCApiModule(Node location, Object sharedLibrary, TruffleString
812812
modulesByIndex.set(mIndex, module);
813813

814814
// add to 'import.c: extensions'
815-
extensions.put(Pair.create(spec.path, spec.name), module.getNativeModuleDef());
815+
extensions.put(Pair.create(spec.path, spec.name), module);
816816
return result;
817817
}
818818
}
819819

820820
@TruffleBoundary
821-
public Object findExtension(TruffleString filename, TruffleString name) {
821+
public PythonModule findExtension(TruffleString filename, TruffleString name) {
822822
return extensions.get(Pair.create(filename, name));
823823
}
824824

0 commit comments

Comments
 (0)