Bugs item #1143895, was opened at 2005-02-18 16:26 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1143895&group_id=5470
Category: Python Library Group: Python 2.4 Status: Open Resolution: None Priority: 7 Submitted By: Armin Rigo (arigo) Assigned to: Johannes Gijsbers (jlgijsbers) Summary: inspect.getsource() breakage in 2.4 Initial Comment: In a real-life case, inspect.getsource() used to produce the correct result on 2.3 but no longer does on 2.4: def somefunc(x, y): # comments ...body... With 2.4 (and 2.5 CVS) the body is completely skipped because the first line doesn't end with a colon. In my opinion that's a critical problem for any code relying on getsource(), even though such code can be considered as relying on a large pile of fragile hacks in the first place... Attached is a patch for test_inspect.py, showing the problem (also includes a different, much more convoluted bug example). It seems that looking for and around ':' in the first line isn't such a good idea; relying more fully on the tokenizer would probably be a better solution. Assigned to jlgijsbers, as the author of the changes that broke this (Dec 12th, 2004). (No blame intended, the change was meant to fix a different bug, and it did so.) ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1143895&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com