File: test401.py

package info (click to toggle)
jython 2.5.3-3%2Bdeb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 43,404 kB
  • ctags: 105,521
  • sloc: python: 351,322; java: 216,346; xml: 1,547; sh: 330; perl: 124; ansic: 102; makefile: 101
file content (18 lines) | stat: -rw-r--r-- 630 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# 
# Test for bug 1758838
#
# execfile(<any file>) 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')", "<input>", "single", None, 1)
interp.exec(code)