Issue 17631: inspect getsource does not display full text of lambda (original) (raw)

Issue17631

Created on 2013-04-03 23:13 by Alexey.Spiridonov, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (2)
msg185975 - (view) Author: Alexey Spiridonov (Alexey.Spiridonov) Date: 2013-04-03 23:13
This happens because the block search algorithm seems not to be handling lambda arguments correctly. $ cat x.py import inspect def a(y): print inspect.getsource(y) print inspect.getsourcelines(y) a( lambda x: x * 3 ) $ python x.py lambda x: ([' lambda x:\n'], 8)
msg199773 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2013-10-13 19:34
Unfortunately, this is impossible to fix with the current implementation, which only tokenizes the source. A full parse would be necessary. Since this is just a minor inconvenience (and there are many situations where the source cannot be found at all), I'm closing this as won't fix.
History
Date User Action Args
2022-04-11 14:57:43 admin set github: 61831
2013-10-13 19:34:39 georg.brandl set status: open -> closednosy: + georg.brandlmessages: + resolution: wont fix
2013-04-03 23:13:59 Alexey.Spiridonov create