Bugs item #1295909, was opened at 2005-09-20 03:00 Message generated for change (Settings changed) made by birkenfeld You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1295909&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: Python Library Group: Python 2.4 Status: Open Resolution: None Priority: 5 Submitted By: Ron Adam (ronadam) >Assigned to: Hye-Shik Chang (perky) Summary: inspect.getsource() misses single line blocks. Initial Comment: While playing around with the inspect module I found that the Blockfinder doesn't recognize single line function definitions. Adding the following two lines to it fixes it, but I'm not sure if it causes problems anywhere else. C:\Python24\Lib>diff.py inspect.py inspect_.py *** inspect.py Tue Mar 15 13:22:02 2005 --- inspect_.py Mon Sep 19 14:26:26 2005 *************** *** 531,536 **** --- 531,538 ---- raise EndOfBlock, self.last elif type == tokenize.NAME and scol == 0: raise EndOfBlock, self.last + elif self.indent == 0: + raise EndOfBlock, self.last def getblock(lines): """Extract the block of code at the top of the given list of lines.""" Version info: Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on win32 def test(t): print '**',t,'**' print "Line:" def f(): pass """ This line shouldn't be visible """ print inspect.getsource(f) print "Block:" def f(): pass pass """This line should not be visible.""" print inspect.getsource(f) import inspect test("before") import inspect_ as inspect test("after") #-- output -- ** before ** Line: def f(): pass """ This line shouldn't be visible """ print inspect.getsource(f) print "Block:" def f(): pass pass Block: def f(): pass pass ** after ** Line: def f(): pass Block: def f(): pass pass ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1295909&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com