Issue1721
Created on 2011-03-21.17:09:52 by kaneiderdaniel, last changed 2012-03-20.03:29:08 by fwierzbicki.
File name |
Uploaded |
Description |
Edit |
Remove |
pyscriptengine.patch
|
kaneiderdaniel,
2011-03-21.17:09:52
|
Patch-file |
|
|
msg6446 (view) |
Author: dak (kaneiderdaniel) |
Date: 2011-03-21.17:09:52 |
|
The two test cases below exit with a
java.lang.NullPointerException
at org.python.core.Py.javas2pys(Py.java:1559)
at org.python.jsr223.PyScriptEngine$1.invoke(PyScriptEngine.java:154)
at $Proxy10.toString(Unknown Source)
.........
public void testGetInterfaceCharSequence1() throws ScriptException, IOException {
ScriptEngineManager manager = new ScriptEngineManager();
ScriptEngine engine = manager.getEngineByName("python");
Invocable invocableEngine = (Invocable) engine;
assertNull(engine.eval(
"from java.lang import CharSequence\n" +
"class MyString(CharSequence):\n" +
" def length(self): return 3\n" +
" def charAt(self, index): return 'a'\n" +
" def subSequence(self, start, end): return \"\"\n" +
" def toString(self): return \"aaa\"\n" +
"c = MyString()"));
CharSequence seq = invocableEngine.getInterface(engine.get("c"), CharSequence.class);
assertEquals("aaa", seq.toString());
}
public void testGetInterfaceCharSequence2() throws ScriptException, IOException {
ScriptEngineManager manager = new ScriptEngineManager();
ScriptEngine pythonEngine = manager.getEngineByName("python");
Invocable invocableEngine = (Invocable) pythonEngine;
assertNull(pythonEngine.eval(
"from java.lang import StringBuilder\r\n" +
"c = StringBuilder(\"abc\")\r\n"));
CharSequence seq = invocableEngine.getInterface(pythonEngine.get("c"), CharSequence.class);
assertEquals("abc", seq.toString());
}
|
msg6911 (view) |
Author: Frank Wierzbicki (fwierzbicki) |
Date: 2012-03-20.03:29:08 |
|
Fixed in http://hg.python.org/jython/rev/8a3ae67fdd25 -- fix will show up in 2.5.3. Thanks for the patch kaneiderdaniel!
|
|
Date |
User |
Action |
Args |
2012-03-20 03:29:08 | fwierzbicki | set | status: open -> closed resolution: fixed messages:
+ msg6911 |
2012-03-19 23:14:40 | fwierzbicki | set | assignee: fwierzbicki nosy:
+ fwierzbicki |
2011-03-21 17:09:52 | kaneiderdaniel | create | |
|