I think I found a bug in Python 2.6.4 (in the inspect module)

Irmen de Jong irmen-NOSPAM- at xs4all.nl
Tue Dec 29 18:38:41 EST 2009


On 29-12-2009 23:22, inhahe wrote:
> On Tue, Dec 29, 2009 at 5:11 PM, inhahe<inhahe at gmail.com>  wrote:
>> On Tue, Dec 29, 2009 at 5:10 PM, inhahe<inhahe at gmail.com>  wrote:
>>>
>>> So i'm guessing that the attribute has been changed from func_code to
>>> f_code but the inspect module wasn't updated to reflect that.
>>>
>>
>> er i mean from f_code to func_code
>>
>
> f_locals doesn't even seem to exist at all.

[...]

I think there are 2 different things :
f_code : 'the code object being executed in this frame'
func_code : 'The code object representing the compiled function'

That is, one is valid in the context of execution stack frames,
while the other is valid in the context of compiled byte code objects 
that are generated for functions and so on.

inspect.getargvalues is used on frames, not on regular code objects.
Maybe you were looking for inspect.getargspec?

-irmen



More information about the Python-list mailing list