On Wed, Nov 07, 2001 at 10:48:01AM -0500, Greg Ward wrote:
>Perhaps Quixote (specifically, quixote.ptl_compile) generates bad
>bytecode in this case. I've managed to disassemble t.ptlc, but I
>haven't figured out how to disassemble t.pyc to compare the two. Neil?
Try something like this: I put the Python code in t2.py and the PTL
code in t.ptl, and changed it to define a function f() containing the
problematic code. This *doesn't* dump core as a PTL module.
Then I can just import the two modules, and use dis.dis() on them:
>>> dis.dis(t2.f) # Python code
0 SET_LINENO 1
3 SET_LINENO 2
6 LOAD_CONST 1 (0)
9 LOAD_CONST 2 (1)
12 BUILD_LIST 2
15 STORE_FAST 0 (a)
18 SET_LINENO 3
21 LOAD_FAST 0 (a)
24 LOAD_CONST 1 (0)
27 DELETE_SUBSCR
28 LOAD_FAST 0 (a)
31 LOAD_CONST 2 (1)
34 DELETE_SUBSCR
35 LOAD_CONST 0 (None)
38 RETURN_VALUE
>>> dis.dis(t.f) # PTL version
0 SET_LINENO 1
3 SET_LINENO 2
6 LOAD_CONST 1 (0)
9 LOAD_CONST 2 (1)
12 BUILD_LIST 2
15 STORE_FAST 0 (a)
18 UNPACK_SEQUENCE 2 << why is this here?
21 SET_LINENO 3
24 LOAD_FAST 0 (a)
27 LOAD_CONST 1 (0)
30 DELETE_SUBSCR
31 LOAD_FAST 0 (a)
34 LOAD_CONST 2 (1)
37 DELETE_SUBSCR
38 LOAD_CONST 0 (None)
41 RETURN_VALUE
>>>
--amk