Bugs item #1246473, was opened at 2005-07-27 19:18 Message generated for change (Comment added) made by bcannon You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1246473&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Parser/Compiler Group: AST Status: Open Resolution: None Priority: 5 Submitted By: Brett Cannon (bcannon) Assigned to: Nobody/Anonymous (nobody) Summary: line numbers off by 1 in dis Initial Comment: test_dis.py:test_dis is failing for two reasons: the line numbers are off by one (need to be bumped up) and the peepholer is not being used and thus the LOAD_CONST(None);RETURN_VALUE idiom is still being tacked on to everything. The former problem needs to be fixed while the latter is not an issue and thus the test needs to get tweaked to allow for the return. ---------------------------------------------------------------------- >Comment By: Brett Cannon (bcannon) Date: 2005-10-07 13:05 Message: Logged In: YES user_id=357491 Maybe, but what would that buy us? We can make the attribute optional on expression nodes and slowly work it all in, but it will need to be done at some point. We could make this the last major fix and deal with everything else that does not rely on this since it is a rather shallow fix in and of itself. ---------------------------------------------------------------------- Comment By: Neil Schemenauer (nascheme) Date: 2005-10-07 12:36 Message: Logged In: YES user_id=35752 As you say, this looks like it will be tedious to fix. Maybe we could change the ast node constructors to take lineno as an optional argument (e.g. using va_list). ---------------------------------------------------------------------- Comment By: Brett Cannon (bcannon) Date: 2005-07-27 22:51 Message: Logged In: YES user_id=357491 Rev. 1.1.2.110 of Python/newcompile.c has the fix for test_dis:test_dis. The more thinking I do about it the more I realize that expression nodes in the AST will need to keep a lineno attribute in order to have lnotab to be set properly. That will not be a fun patch to do. ---------------------------------------------------------------------- Comment By: Brett Cannon (bcannon) Date: 2005-07-27 22:25 Message: Logged In: YES user_id=357491 I don't think this last problem is easily fixed. If you look at the AST, only statements have a lineno attribute. But it is an expression that is on another line from the main line of the statement. I cannot think of any way to get the line information from the statement without adding a lineno attribute to expressions and removing it from statements. That should give the coverage needed to know when another line is being outputted. ---------------------------------------------------------------------- Comment By: Brett Cannon (bcannon) Date: 2005-07-27 20:59 Message: Logged In: YES user_id=357491 I have test_dis now passing thanks to some refactoring to handle the initial line. Now I just need to try to fix test_bug_708901. ---------------------------------------------------------------------- Comment By: Brett Cannon (bcannon) Date: 2005-07-27 19:40 Message: Logged In: YES user_id=357491 OK, so first oddity; in both Python 2.5 and the AST branch co_firstlineno, when working on a function at the interpreter prompt, is set to 1. But if you look at co_lnotab, AST has '\x05\x01' while 2.5 has '\x00\x01\x05\x01'. If you tack on another line to the test function, AST has '\x05\x01\x05\x01' while 2.5 has '\x00\x01\x05\x01\x05\x01'. The critical thing is the initial '\x00\x01'. Looks like 2.5 tacks that on or somehow decides it needs to state the initial line at 0 is a byte long. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1246473&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com