This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author arigo
Recipients
Date 2005-02-18.16:26:01
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
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.)
History
Date User Action Args
2007-08-23 14:29:39adminlinkissue1143895 messages
2007-08-23 14:29:39admincreate