Issue1674

classification
Title: PDB crashes under the JSR-223 scripting engine
Type: crash Severity: major
Components: Core Versions: 2.5.2b1
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: otmarhumbel Nosy List: alex.gronholm, otmarhumbel
Priority: Keywords:

Created on 2010-11-03.11:24:25 by alex.gronholm, last changed 2010-11-09.22:57:50 by otmarhumbel.

Files
File name Uploaded Description Edit Remove
1674-test-patch.txt otmarhumbel, 2010-11-04.21:53:49 a java junit test
1674-work-in-progress.txt otmarhumbel, 2010-11-04.23:45:07 work in progress
1674-patch.txt otmarhumbel, 2010-11-06.00:12:50 the fix
Messages
msg6224 (view) Author: Alex Grönholm (alex.gronholm) Date: 2010-11-03.11:24:23
Trying a script with nothing but "from pdb import set_trace; set_trace()" through the Jython JSR-223 engine results in this:

>javax.script.ScriptException: TypeError: 'scope' object is not iterable in /home/alex/libs/jython2.5.2rc2/Lib/bdb.py at line number 52
	at org.python.jsr223.PyScriptEngine.scriptException(PyScriptEngine.java:191)
	at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:42)
	at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:47)
	at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:249)
	at myscript.ScriptingTest.main(ScriptingTest.java:26)

Caused by: Traceback (most recent call last):
  File "/home/alex/libs/jython2.5.2rc2/Lib/bdb.py", line 52, in trace_dispatch
    return self.dispatch_return(frame, arg)
  File "/home/alex/libs/jython2.5.2rc2/Lib/bdb.py", line 85, in dispatch_return
    self.user_return(frame, arg)
  File "/home/alex/libs/jython2.5.2rc2/Lib/pdb.py", line 170, in user_return
    self.interaction(frame, None)
  File "/home/alex/libs/jython2.5.2rc2/Lib/pdb.py", line 186, in interaction
    self.print_stack_entry(self.stack[self.curindex])
  File "/home/alex/libs/jython2.5.2rc2/Lib/pdb.py", line 827, in print_stack_entry
    print >>self.stdout, self.format_stack_entry(frame_lineno,
  File "/home/alex/libs/jython2.5.2rc2/Lib/bdb.py", line 335, in format_stack_entry
    if '__args__' in frame.f_locals:
TypeError: 'scope' object is not iterable
msg6228 (view) Author: Oti Humbel (otmarhumbel) Date: 2010-11-04.21:53:48
The JUnit test in 1674-test-patch.txt exposes the problem
msg6229 (view) Author: Oti Humbel (otmarhumbel) Date: 2010-11-04.23:45:07
PyScriptEngineScope is not iterable, but emulates globals and locals.
If I make it iterable (by implementing __iter__()), the TypeError goes away
msg6230 (view) Author: Oti Humbel (otmarhumbel) Date: 2010-11-06.00:12:49
The patch in file 1674-patch.txt makes the engine scope iterable and passes all regrtests locally
msg6243 (view) Author: Oti Humbel (otmarhumbel) Date: 2010-11-09.22:57:50
fixed in revision 7169
History
Date User Action Args
2010-11-09 22:57:50otmarhumbelsetstatus: open -> closed
resolution: fixed
messages: + msg6243
2010-11-06 00:12:51otmarhumbelsetfiles: + 1674-patch.txt
assignee: otmarhumbel
messages: + msg6230
2010-11-04 23:45:08otmarhumbelsetfiles: + 1674-work-in-progress.txt
messages: + msg6229
2010-11-04 21:53:49otmarhumbelsetfiles: + 1674-test-patch.txt
nosy: + otmarhumbel
messages: + msg6228
2010-11-03 11:24:25alex.gronholmcreate