This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author xtreak
Recipients rhettinger, terry.reedy, xtreak
Date 2018-07-28.15:09:47
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1532790587.41.0.56676864532.issue34254@psf.upfronthosting.co.za>
In-reply-to
Content
I have added support for functions defined inside a function and methods of a class along with some basic tests. Since directly taking co_name from code object returns only the name without any context like Foo.square inside square when I try to access co_name. So I have passed the function object available at the calls as an additional parameter. Since the API is not public or documented I think it's okay to add an argument in those places. Thus by directly having the function object I am able to get the annotations directly instead of making a lookup in the globals.

This approach makes places where TypeError is raised to pass function object like too much of positional arguments and keyword arguments type of errors etc. The code to form the error string can be refactored out as a helper function thus the logic takes a function object and returns the error message. I think this would require more changes in places to pass function object than my original approach to cover more areas thus adding some complexity.

Thanks
History
Date User Action Args
2018-07-28 15:09:47xtreaksetrecipients: + xtreak, rhettinger, terry.reedy
2018-07-28 15:09:47xtreaksetmessageid: <1532790587.41.0.56676864532.issue34254@psf.upfronthosting.co.za>
2018-07-28 15:09:47xtreaklinkissue34254 messages
2018-07-28 15:09:47xtreakcreate