Author yselivanov
Recipients Claudiu.Popa, Yury.Selivanov, larry, michael.foord, ncoghlan, terry.reedy, yselivanov
Date 2014-01-19.22:56:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1390172202.76.0.681162095542.issue17481@psf.upfronthosting.co.za>
In-reply-to
Content
>> 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.
History
Date User Action Args
2014-01-19 22:56:42yselivanovsetrecipients: + yselivanov, terry.reedy, ncoghlan, larry, michael.foord, Claudiu.Popa, Yury.Selivanov
2014-01-19 22:56:42yselivanovsetmessageid: <1390172202.76.0.681162095542.issue17481@psf.upfronthosting.co.za>
2014-01-19 22:56:42yselivanovlinkissue17481 messages
2014-01-19 22:56:42yselivanovcreate