[Patches] [ python-Patches-1006219 ] inspect.getsource show @decorators and one-liners

SourceForge.net noreply at sourceforge.net
Sun Aug 15 16:43:28 CEST 2004


Patches item #1006219, was opened at 2004-08-09 23:32
Message generated for change (Settings changed) made by percivall
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1006219&group_id=5470

Category: Library (Lib)
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Simon Percivall (percivall)
Assigned to: Nobody/Anonymous (nobody)
>Summary: inspect.getsource show @decorators and one-liners

Initial Comment:
The getsource function in inspect.py breaks badly with
the @decorators.

The inspect mechanism scans backwards from the topmost
decorator until it finds some acceptable statement (it
can be anything: another function, an import line, etc.).

The patch takes care of that. It'll print all
decorators for a function as well as the function itself.

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

Comment By: Johannes Gijsbers (jlgijsbers)
Date: 2004-08-15 14:56

Message:
Logged In: YES 
user_id=469548

Handling one-line functions fixes problem 1 reported in
http://python.org/sf/769569.

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

Comment By: Johannes Gijsbers (jlgijsbers)
Date: 2004-08-15 14:41

Message:
Logged In: YES 
user_id=469548

The patch seems okay on casual inspection, but it still
needs to have tests. Feel free to assign it to me after
adding those.

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

Comment By: Simon Percivall (percivall)
Date: 2004-08-12 16:16

Message:
Logged In: YES 
user_id=329382

Also fix that getsource really doesn't handle one-line
functions, with new patch.

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

Comment By: Simon Percivall (percivall)
Date: 2004-08-11 20:22

Message:
Logged In: YES 
user_id=329382

Yes, it does.

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

Comment By: Simon Percivall (percivall)
Date: 2004-08-10 13:19

Message:
Logged In: YES 
user_id=329382

Yeah ... It doesn't really fix anything.

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

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


More information about the Patches mailing list