Issue1174

classification
Title: NPE on PythonInterpreter.eval()
Type: crash Severity: major
Components: Core Versions: 2.5b0
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: fwierzbicki Nosy List: amak, fwierzbicki
Priority: Keywords:

Created on 2008-11-18.19:40:02 by amak, last changed 2008-11-22.19:21:08 by fwierzbicki.

Messages
msg3787 (view) Author: Alan Kennedy (amak) Date: 2008-11-18.19:40:02
The following snippet causes an NPE in the 2.5b0.

This code should work, unless there's been an undocumented change in the
PythonInterpreter API?

// EvalBug.java
import org.python.core.*;
import org.python.util.*;

public class EvalBug
{
  public static void main (String [] args)
  {
    PythonInterpreter.initialize(System.getProperties(), null, new
String[] {});
    PythonInterpreter interp = new PythonInterpreter();
    PyObject pyo = interp.eval("{u'one': u'two'}");
    System.out.println("Result is : " + pyo);
  }
}
msg3788 (view) Author: Alan Kennedy (amak) Date: 2008-11-18.19:42:21
Sorry, forgot to post the traceback; which follows

C:\jython25b0>java EvalBug
*sys-package-mgr*: can't create package cache dir,
'C:\jython25b0\jython-complete.jar\cachedir\packages'
Exception in thread "main" java.lang.NullPointerException
        at org.python.core.ParserFacade.prepBufReader(ParserFacade.java:237)
        at org.python.core.ParserFacade.parse(ParserFacade.java:142)
        at org.python.core.Py.compile_flags(Py.java:1741)
        at org.python.core.CompileFunction.compile(__builtin__.java:1550)
        at org.python.core.CompileFunction.compile(__builtin__.java:1527)
        at org.python.core.__builtin__.eval(__builtin__.java:495)
        at org.python.core.__builtin__.eval(__builtin__.java:504)
        at
org.python.util.PythonInterpreter.eval(PythonInterpreter.java:116)
        at EvalBug.main(EvalBug.java:13)

java.lang.NullPointerException: java.lang.NullPointerException
msg3803 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2008-11-22.19:21:07
Not a new API -- this is definitely a bug.  Fixed in r5598.
History
Date User Action Args
2008-11-22 19:21:08fwierzbickisetstatus: open -> closed
resolution: fixed
messages: + msg3803
2008-11-22 16:13:55fwierzbickisetassignee: fwierzbicki
nosy: + fwierzbicki
2008-11-18 19:42:21amaksetmessages: + msg3788
2008-11-18 19:40:03amakcreate