Karthikeyan Singaravelan <tir.kar...@gmail.com> added the comment:

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

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue34254>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to