[issue17481] inspect.getfullargspec should use __signature__

2014-01-29 Thread Yury Selivanov
Yury Selivanov added the comment: Committed. Thanks for the reviews! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17481 ___ ___

[issue17481] inspect.getfullargspec should use __signature__

2014-01-29 Thread Yury Selivanov
Changes by Yury Selivanov yselivanov...@gmail.com: -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17481 ___

[issue17481] inspect.getfullargspec should use __signature__

2014-01-29 Thread Roundup Robot
Roundup Robot added the comment: New changeset 0fa2750c7241 by Yury Selivanov in branch 'default': inspect.test.getfullargspec: Add a unittest to ensure correct annotations http://hg.python.org/cpython/rev/0fa2750c7241 -- ___ Python tracker

[issue17481] inspect.getfullargspec should use __signature__

2014-01-29 Thread Roundup Robot
Roundup Robot added the comment: New changeset 6d1e8162e855 by Yury Selivanov in branch 'default': inspect.getfullargspec: Use inspect.signature API behind the scenes #17481 http://hg.python.org/cpython/rev/6d1e8162e855 -- nosy: +python-dev ___

[issue17481] inspect.getfullargspec should use __signature__

2014-01-28 Thread Yury Selivanov
Yury Selivanov added the comment: Larry and Nick, Please review the final patch (getargsspec_04.patch). I'd like to commit it tomorrow. This one is the last one (hopefully), and it supports builtin methods properly -- i.e. works around 'self' parameter correctly. To do that, I check if the

[issue17481] inspect.getfullargspec should use __signature__

2014-01-28 Thread Yury Selivanov
Changes by Yury Selivanov yselivanov...@gmail.com: -- keywords: +needs review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17481 ___ ___

[issue17481] inspect.getfullargspec should use __signature__

2014-01-27 Thread Yury Selivanov
Yury Selivanov added the comment: There's a major difference between getfullargspec/getargspec and inspect.signature: getfullargspec shows you the self parameter for bound methods, and inspect.signature does not. Larry, yes, that's correct. The attached patch simulates this behaviour,

[issue17481] inspect.getfullargspec should use __signature__

2014-01-24 Thread Nick Coghlan
Nick Coghlan added the comment: Another case of don't land it until Larry has dealt with the builtins. The patch itself looks fine, though :) -- dependencies: +inspect.Signature doesn't recognize all builtin types ___ Python tracker

[issue17481] inspect.getfullargspec should use __signature__

2014-01-24 Thread Larry Hastings
Larry Hastings added the comment: The patch from #20189 has landed. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17481 ___ ___

[issue17481] inspect.getfullargspec should use __signature__

2014-01-24 Thread Larry Hastings
Larry Hastings added the comment: There's a major difference between getfullargspec/getargspec and inspect.signature: getfullargspec shows you the self parameter for bound methods, and inspect.signature does not. class C: ...def foo(self, a): pass ... c = C() import inspect

[issue17481] inspect.getfullargspec should use __signature__

2014-01-23 Thread Yury Selivanov
Yury Selivanov added the comment: Larry, Nick, So what's the resolution on this one? Do I have a green light? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17481 ___

[issue17481] inspect.getfullargspec should use __signature__

2014-01-23 Thread Larry Hastings
Larry Hastings added the comment: My solution for pydoc was to call isroutine() instead of isfunction(), and yes handle it throwing an exception. (I just checked, and I wasn't catching TypeError, only ValueError. I'll fix that in my next patch for #20189.) --

[issue17481] inspect.getfullargspec should use __signature__

2014-01-20 Thread Nick Coghlan
Nick Coghlan added the comment: Ah, I had indeed missed the fact that getfullargspec() was still calling isfunction(). In that case, is the patch currently actually buying us anything much beyond handling __signature__ attributes? Most of the new types that inspect.signature() supports will

[issue17481] inspect.getfullargspec should use __signature__

2014-01-20 Thread Yury Selivanov
Yury Selivanov added the comment: Instead of keeping the check, we could just unconditionally convert exceptions from the signature call to a TypeError in order to maintain compatibility with the old external behaviour. Agreed. See the new patch (getargsspec_02.patch) Unfortunately, we

[issue17481] inspect.getfullargspec should use __signature__

2014-01-20 Thread Yury Selivanov
Yury Selivanov added the comment: Larry, I created a separate issue for that: http://bugs.python.org/issue20313 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17481 ___

[issue17481] inspect.getfullargspec should use __signature__

2014-01-19 Thread Terry J. Reedy
Terry J. Reedy added the comment: The relevant code in CallTips.py is argspec = if hasattr(ob, '__call__'): ... if isinstance(fob, (types.FunctionType, types.MethodType)): argspec = inspect.formatargspec(*inspect.getfullargspec(fob)) So I want to broaden the second condition (or

[issue17481] inspect.getfullargspec should use __signature__

2014-01-19 Thread Larry Hastings
Larry Hastings added the comment: I just want to mention, while we're all thinking about this stuff: I plan to enhance the Signature object to reflect optional groups. Right now Signature objects cannot express parameters that are optional but don't have a published default. (e.g. a string

[issue17481] inspect.getfullargspec should use __signature__

2014-01-19 Thread Nick Coghlan
Nick Coghlan added the comment: Sounds reasonable - we'll need that to convert range() and slice() anyway (I totally failed at finding time to look at the builtins this weekend, but I'd still like to handle those before the 3rd beta). An alternative would be to actually add ParameterGroup as a

[issue17481] inspect.getfullargspec should use __signature__

2014-01-19 Thread Yury Selivanov
Yury Selivanov added the comment: Larry, I saw your message on the tracker regarding adding support for parameters groups to the signature object. Would you mind if I join the discussion with my ideas of how this feature might be implemented? Yury On Sunday, January 19, 2014 at 5:44 AM,

[issue17481] inspect.getfullargspec should use __signature__

2014-01-19 Thread Terry J. Reedy
Terry J. Reedy added the comment: Yuri, I am sure your ideas for enhancing signature objects would be welcome. Either a new issue or a thread on pydev or python-ideas lists would be best. When responding by email, please snip the quotation and footer, except possibly a line of the quoted

[issue17481] inspect.getfullargspec should use __signature__

2014-01-19 Thread Yury Selivanov
Yury Selivanov added the comment: Terry, Thanks. When responding by email, please snip the quotation and footer, except possibly a line of the quoted message. My email client played an evil (and a bit embarrassing) trick with me, showing Larry's name without an actual email address,

[issue17481] inspect.getfullargspec should use __signature__

2014-01-19 Thread Yury Selivanov
Yury Selivanov added the comment: 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. --

[issue17481] inspect.getfullargspec should use __signature__

2014-01-19 Thread Larry Hastings
Larry Hastings added the comment: Yury: fire away, either here or in a new issue as is best. (Sorry, brain mildly fried, not sure what would be best issue-tracker hygiene.) -- ___ Python tracker rep...@bugs.python.org

[issue17481] inspect.getfullargspec should use __signature__

2014-01-19 Thread Yury Selivanov
Yury Selivanov added the comment: 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

[issue17481] inspect.getfullargspec should use __signature__

2014-01-19 Thread Yury Selivanov
Yury Selivanov added the comment: Yury: fire away, either here or in a new issue as is best. (Sorry, brain mildly fried, not sure what would be best issue-tracker hygiene.) Larry, I ended up with a relatively big core dump of my thoughts, so I decided to post it on python-dev. Let's

[issue17481] inspect.getfullargspec should use __signature__

2014-01-18 Thread Nick Coghlan
Nick Coghlan added the comment: I upgraded the description to a should. Argument Clinic and other changes in Python 3.4 greatly improve introspection support for various aspects of the runtime and standard library (for example, issue 20223 will handle the new functools.partialmethod support).

[issue17481] inspect.getfullargspec should use __signature__

2014-01-18 Thread Larry Hastings
Larry Hastings added the comment: If we modify inspect.getfullargspec, shouldn't we modify inspect.getargspec too? deprecated doesn't mean unsupported, it means not recommended for new code, please stop using it. -- ___ Python tracker

[issue17481] inspect.getfullargspec should use __signature__

2014-01-18 Thread Yury Selivanov
Yury Selivanov added the comment: Larry, getargspec uses getfullargspec, so it's covered. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17481 ___

[issue17481] inspect.getfullargspec should use __signature__

2014-01-18 Thread Nick Coghlan
Nick Coghlan added the comment: getargspec() is just a thin wrapper around getfullargspec(), so we get that for free. Similarly, getcallargs() is also implicitly updated to full PEP 362 support by changing the implementation of getfullargspec(). The other two standard library consumers