[Python-bugs-list] [ python-Bugs-607092 ] wrong SET_LINENO w/ multi-line func args

noreply@sourceforge.net noreply@sourceforge.net
Mon, 09 Sep 2002 19:18:38 -0700


Bugs item #607092, was opened at 2002-09-10 02:18
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=607092&group_id=5470

Category: Parser/Compiler
Group: Python 2.2.1
Status: Open
Resolution: None
Priority: 5
Submitted By: Inyeol Lee (inyeol)
Assigned to: Nobody/Anonymous (nobody)
Summary: wrong SET_LINENO w/ multi-line func args

Initial Comment:
Python 2.2.1 (#1, Apr 10 2002, 18:25:16) 
[GCC 2.95.3 20010315 (release)] on sunos5
Type "help", "copyright", "credits" or "license" for
more information.
>>> import dis
>>> def f():  # line 1
...   a = [1, # line 2
...     2]
...   b = (1, # line 4
...     2)
...   c(1,    # line 6
...     2)
... 
>>> dis.dis(f)
          0 SET_LINENO               1

          3 SET_LINENO               2
          6 LOAD_CONST               1 (1)
          9 LOAD_CONST               2 (2)
         12 BUILD_LIST               2
         15 STORE_FAST               0 (a)

         18 SET_LINENO               4
         21 LOAD_CONST               1 (1)
         24 LOAD_CONST               2 (2)
         27 BUILD_TUPLE              2
         30 STORE_FAST               1 (b)

         33 SET_LINENO               6
         36 LOAD_GLOBAL              2 (c)
         39 LOAD_CONST               1 (1)

         42 SET_LINENO               7              
<-- Error, should not be here.
         45 LOAD_CONST               2 (2)
         48 CALL_FUNCTION            2
         51 POP_TOP             
         52 LOAD_CONST               0 (None)
         55 RETURN_VALUE        
>>> 

python 2.2.1 generates errornous SET_LINENO instruction
when
function arguments tuple is separated by physical, not
logical newline.
This results in errornous frame.f_lineno.

-Inyeol Lee


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=607092&group_id=5470