Message208509
>> Otherwise we run the risk of introducing unexpected exceptions into introspection code.
> That's a good catch. I'll make a new patch, keeping the old implementation of getfullargsspec intact, and falling back to it if no signature can be found.
Nick, while I was working on the second patch (writing a new unittest for it specifically), I realized, that it's not that easy to make the old version of "getfullargsspec" to spit out any exception that it doesn't currently do with the proposed 'getargsspec_01.patch'.
See, the old "getfullargsspec" does the following:
1. Check if the passed object is a function, with 'inspect.isfunction'. If not - throw a TypeError. That behaviour is duplicated in the patch, so we are safe here.
2. Call on the object's __code__ '_getfullargs', which validates that the passed code object is a valid code object, and simply returns its attributes rearranged a bit.
Now, to have any exception in (2), we need: either a broken __code__ object, or something that is an instance of "types.FunctionType" (hence, defined in python) but doesn't have the "__code__" attribute. And that's kind of hard to achieve. |
|
Date |
User |
Action |
Args |
2014-01-19 22:56:42 | yselivanov | set | recipients:
+ yselivanov, terry.reedy, ncoghlan, larry, michael.foord, Claudiu.Popa, Yury.Selivanov |
2014-01-19 22:56:42 | yselivanov | set | messageid: <1390172202.76.0.681162095542.issue17481@psf.upfronthosting.co.za> |
2014-01-19 22:56:42 | yselivanov | link | issue17481 messages |
2014-01-19 22:56:42 | yselivanov | create | |
|