File tree Expand file tree Collapse file tree 1 file changed +6
-8
lines changed
graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -497,15 +497,13 @@ public abstract static class CreateBuiltin extends PythonBuiltinNode {
497
497
@ SuppressWarnings ("unused" )
498
498
@ Specialization
499
499
@ TruffleBoundary
500
- public Object run (PythonObject moduleSpec ) {
501
- Object origin = moduleSpec . getAttribute ( "origin" );
500
+ public Object run (PythonObject moduleSpec ,
501
+ @ Cached CastToJavaStringNode toJavaStringNode ) {
502
502
Object name = moduleSpec .getAttribute ("name" );
503
- if ("built-in" .equals (origin )) {
504
- for (String bm : getCore ().builtinModuleNames ()) {
505
- if (bm .equals (name )) {
506
- return getCore ().lookupBuiltinModule (bm );
507
- }
508
- }
503
+ PythonModule builtinModule = getCore ().lookupBuiltinModule (toJavaStringNode .execute (name ));
504
+ if (builtinModule != null ) {
505
+ // TODO: builtin modules cannot be re-initialized (see is_builtin)
506
+ return builtinModule ;
509
507
}
510
508
throw raise (NotImplementedError , "_imp.create_builtin" );
511
509
}
You can’t perform that action at this time.
0 commit comments