Issue1006219
Created on 2004年08月09日 21:32 by simon.percivall, last changed 2022年04月11日 14:56 by admin. This issue is now closed.
| Messages (9) |
|
msg46614 - (view) |
Author: Simon Percivall (simon.percivall) |
Date: 2004年08月09日 21:32 |
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.
|
|
msg46615 - (view) |
Author: Simon Percivall (simon.percivall) |
Date: 2004年08月10日 11:19 |
Logged In: YES
user_id=329382
Yeah ... It doesn't really fix anything.
|
|
msg46616 - (view) |
Author: Simon Percivall (simon.percivall) |
Date: 2004年08月11日 18:22 |
Logged In: YES
user_id=329382
Yes, it does.
|
|
msg46617 - (view) |
Author: Simon Percivall (simon.percivall) |
Date: 2004年08月12日 14:16 |
Logged In: YES
user_id=329382
Also fix that getsource really doesn't handle one-line
functions, with new patch.
|
|
msg46618 - (view) |
Author: Johannes Gijsbers (jlgijsbers) * (Python triager) |
Date: 2004年08月15日 12:41 |
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.
|
|
msg46619 - (view) |
Author: Johannes Gijsbers (jlgijsbers) * (Python triager) |
Date: 2004年08月15日 12:56 |
Logged In: YES
user_id=469548
Handling one-line functions fixes problem 1 reported in
http://python.org/sf/769569.
|
|
msg46620 - (view) |
Author: Simon Percivall (simon.percivall) |
Date: 2004年08月15日 15:34 |
Logged In: YES
user_id=329382
Added tests for the patch.
Note that the patch for showing one-liners breaks two-line
lambdas.
|
|
msg46621 - (view) |
Author: Simon Percivall (simon.percivall) |
Date: 2004年08月15日 15:44 |
Logged In: YES
user_id=329382
Eh, that should be:
Note that the patch for showing one-liners breaks showing
the source of two-line lambdas. Only the first line shows.
|
|
msg46622 - (view) |
Author: Johannes Gijsbers (jlgijsbers) * (Python triager) |
Date: 2004年08月18日 12:58 |
Logged In: YES
user_id=469548
Okay, I've checked in the patch that handles decorators as
rev 1.54 of inspect.py and rev 1.16 of test_inspect.py (note
that I integrated your tests into this file).
The oneline and twoline cases in test_inspect_decorators.py
don't fail for me, even without the patch, so I'm not
applying a patch that breaks a previously working case <wink>.
If you're still interested in fixing this, I suggest you
write down all the test cases that should work (including
http://python.org/sf/769569 and having a twoline lambda at
the end of a file), see whether they fail now and open a new
tracker item with a patch that fixes those that don't.
|
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2022年04月11日 14:56:06 | admin | set | github: 40732 |
| 2004年08月09日 21:32:27 | simon.percivall | create |