File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
graalpython/com.oracle.graal.python/src/com/oracle/graal/python/runtime Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change 106
106
import com .oracle .truffle .api .utilities .CyclicAssumption ;
107
107
108
108
public final class PythonContext {
109
+ private static final Source IMPORT_WARNINGS_SOURCE = Source .newBuilder (PythonLanguage .ID , "import warnings\n " , "<internal>" ).internal (true ).build ();
110
+ private static final Source FORCE_IMPORTS_SOURCE = Source .newBuilder (PythonLanguage .ID , "import site\n " , "<internal>" ).internal (true ).build ();
109
111
private static final TruffleLogger LOGGER = PythonLanguage .getLogger (PythonContext .class );
110
112
private volatile boolean finalizing ;
111
113
@@ -467,12 +469,12 @@ public void patch(Env newEnv) {
467
469
468
470
private void importSiteIfForced () {
469
471
if (getOption (PythonOptions .ForceImportSite )) {
470
- CallTarget site = env .parsePublic (Source . newBuilder ( PythonLanguage . ID , "import site \n " , "<internal>" ). internal ( true ). build () );
472
+ CallTarget site = env .parsePublic (FORCE_IMPORTS_SOURCE );
471
473
site .call ();
472
474
}
473
475
if (!getOption (PythonOptions .WarnOptions ).isEmpty ()) {
474
476
// we must force an import of the warnings module here if warnings were passed
475
- CallTarget site = env .parsePublic (Source . newBuilder ( PythonLanguage . ID , "import warnings \n " , "<internal>" ). internal ( true ). build () );
477
+ CallTarget site = env .parsePublic (IMPORT_WARNINGS_SOURCE );
476
478
site .call ();
477
479
}
478
480
}
You can’t perform that action at this time.
0 commit comments