Index: C:/workspace/jython_svn/jython/bugtests/test401/to_be_executed.py =================================================================== --- C:/workspace/jython_svn/jython/bugtests/test401/to_be_executed.py (revision 0) +++ C:/workspace/jython_svn/jython/bugtests/test401/to_be_executed.py (revision 0) @@ -0,0 +1,4 @@ +# the contents of this file are not important for bug 1758838 + +class TestBug1758838: + pass Index: C:/workspace/jython_svn/jython/bugtests/test401.py =================================================================== --- C:/workspace/jython_svn/jython/bugtests/test401.py (revision 0) +++ C:/workspace/jython_svn/jython/bugtests/test401.py (revision 0) @@ -0,0 +1,18 @@ +# +# Test for bug 1758838 +# +# execfile() should not throw a NullPointerException +# +# The error only shows up in interactive interpretation (type "single" for the compilation). +# But we cannot use InteractiveInterpreter here since it catches all Exceptions, +# therefore we do the compilation 'by hand'. +# + +from org.python.core import Py +from org.python.core import PySystemState +from org.python.util import PythonInterpreter + +PySystemState.initialize() +interp = PythonInterpreter() +code = Py.compile_command_flags("execfile('test401/to_be_executed.py')", "", "single", None, 1) +interp.exec(code)