[issue19903] Idle: Use inspect.signature for calltips

2017-08-10 Thread Terry J. Reedy
Terry J. Reedy added the comment: This is much clearer. What you got is a limitation of getfullargspec relative to signature (see the links). In this case, you want follow_wrapped=True, to get the specific signature of the wrapped function instead of the generic signature of the wrapper*.

[issue19903] Idle: Use inspect.signature for calltips

2017-08-09 Thread Vedran Čačić
Vedran Čačić added the comment: Hm... now I see that link is very misleading... it opens a blog post, and then only a few seconds later jumps to the comment. So now I'll paste the comment here, to avoid misunderstandings: Python3.6.0 (now in 2017). I start IDLE, and write >>> def deco(f):

[issue19903] Idle: Use inspect.signature for calltips

2017-08-09 Thread Terry J. Reedy
Terry J. Reedy added the comment: This issue is about IDLE getting further out of the business of calculating signatures and depending instead on the newest (and tested) inspect function. In 2012, the blogger used getargspec, which was deprecated for 3.x a few years before, in 3.0. I suspect

[issue19903] Idle: Use inspect.signature for calltips

2017-08-09 Thread Terry J. Reedy
Terry J. Reedy added the comment: Although my freshly opened window says PR2822 is open, it was merged with https://github.com/python/cpython/commit/3b0f620c1a2a21272a9e2aeca6ca1d1ac10f8162 4 hours ago, and then backported. Louie, thanks for the patch and the persistence. --

[issue19903] Idle: Use inspect.signature for calltips

2017-08-09 Thread Terry J. Reedy
Terry J. Reedy added the comment: New changeset 646f6c3096abfe5bde13f039ebf32bce5baf083a by Terry Jan Reedy in branch '3.6': [3.6] bpo-19903: IDLE: Calltips changed to use inspect.signature (GH-2822) (#3053) https://github.com/python/cpython/commit/646f6c3096abfe5bde13f039ebf32bce5baf083a

[issue19903] Idle: Use inspect.signature for calltips

2017-08-09 Thread Vedran Čačić
Vedran Čačić added the comment: Am I right in assuming this will also fix the bug mentioned in this comment https://emptysqua.re/blog/copying-a-python-functions-signature/#comment-1816090904 ? If yes, I'm glad I didn't have to report it. :-) -- nosy: +veky

[issue19903] Idle: Use inspect.signature for calltips

2017-08-09 Thread Terry J. Reedy
Changes by Terry J. Reedy : -- pull_requests: +3086 ___ Python tracker ___ ___

[issue19903] Idle: Use inspect.signature for calltips

2017-08-03 Thread Terry J. Reedy
Changes by Terry J. Reedy : -- stage: test needed -> commit review ___ Python tracker ___

[issue19903] Idle: Use inspect.signature for calltips

2017-07-23 Thread Louie Lu
Changes by Louie Lu : -- pull_requests: +2874 ___ Python tracker ___ ___ Python-bugs-list

[issue19903] Idle: Use inspect.signature for calltips

2017-05-05 Thread Terry J. Reedy
Terry J. Reedy added the comment: What is List? Not a builtin. I am guessing that $self means to remove for bound methods. In any case, __text_signature__ is effectively private to inspect.signature. We only care what the latter produces. --

[issue19903] Idle: Use inspect.signature for calltips

2017-05-05 Thread Louie Lu
Louie Lu added the comment: And, another case, the __text_signature__ and i.signature() is similar, but not the same: >>> range.__init__.__text_signature__ '($self, /, *args, **kwargs)' ^ >>> str(i.signature(range.__init__)) '(self, /, *args, **kwargs)' So we can't simply

[issue19903] Idle: Use inspect.signature for calltips

2017-05-05 Thread Louie Lu
Louie Lu added the comment: But somehow in this case, List have no __text_signature__: >>> str(i.signature(list)) '(iterable=(), /)' >>> list.__text_signature__ '(iterable=(), /)' >>> str(i.signature(List)) '(iterable=(), /)' >>> List.__text_signature__ >>> --

[issue19903] Idle: Use inspect.signature for calltips

2017-05-04 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: As well as __name__, __qualname__, __module__, __bases__, __call__, mro, etc. -- ___ Python tracker ___

[issue19903] Idle: Use inspect.signature for calltips

2017-05-04 Thread Terry J. Reedy
Terry J. Reedy added the comment: Interesting dir(list.append) and the IDLE completion box show __text_signature__. dir(list) and the box do not. -- ___ Python tracker

[issue19903] Idle: Use inspect.signature for calltips

2017-05-04 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: >>> list.__text_signature__ '(iterable=(), /)' But IDLE shouldn't use __text_signature__ directly, it should use the inspect module. -- ___ Python tracker

[issue19903] Idle: Use inspect.signature for calltips

2017-05-04 Thread Terry J. Reedy
Terry J. Reedy added the comment: (I presume'ordinal' meant 'ordinary'.) I don't know where signature finds the info on built-in type objects Methods like .append have .__text_signature__. List does not, and list.__call__.__text_signature is the generic '($self, /, *args, **kwargs)'.

[issue19903] Idle: Use inspect.signature for calltips

2017-05-04 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Ah, yes, __new__ and __init__ differ from ordinal methods. They don't have docstrings generated by Argument Clinic. But list itself as a callable have correct signature. >>> inspect.signature(list) -- ___

[issue19903] Idle: Use inspect.signature for calltips

2017-05-04 Thread Terry J. Reedy
Terry J. Reedy added the comment: help(object.__init__) and help(list.__init__) have exactly the same output. -- ___ Python tracker ___

[issue19903] Idle: Use inspect.signature for calltips

2017-05-04 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: list.__new__ is inherited from object. Look at list.__init__. -- ___ Python tracker ___

[issue19903] Idle: Use inspect.signature for calltips

2017-05-04 Thread Terry J. Reedy
Terry J. Reedy added the comment: >>> help(list.__new__) Help on built-in function __new__: __new__(*args, **kwargs) method of builtins.type instance Create and return a new object. See help(type) for accurate signature. 'list.__new__(' currently pops up just the docstring. I think

[issue19903] Idle: Use inspect.signature for calltips

2017-05-04 Thread Yury Selivanov
Changes by Yury Selivanov : -- nosy: -yselivanov ___ Python tracker ___ ___

[issue19903] Idle: Use inspect.signature for calltips

2017-05-04 Thread Terry J. Reedy
Terry J. Reedy added the comment: Let's back up. The high-level specification for get_argspec is something like 'Return information that will help programmers write a correct call." The proposed implementation strategy is to combine signature info from signature (replacing getfullargspec)

[issue19903] Idle: Use inspect.signature for calltips

2017-05-04 Thread Louie Lu
Louie Lu added the comment: Thing just getting weird. If we remove the guard, some of the builtin function will get not-so-good signature result: >>> i.signature(range.__init__) >>> i.signature(list.append) >>>

[issue19903] Idle: Use inspect.signature for calltips

2017-05-04 Thread Terry J. Reedy
Terry J. Reedy added the comment: A review is not required to commit. The PR itself says "Add more commits by pushing to the bpo-19903 branch on lulouie/cpython." As far as I know, unresolved requests do not block for cpython. The Merge button appears to still be 'alive' after my red

[issue19903] Idle: Use inspect.signature for calltips

2017-05-04 Thread Louie Lu
Louie Lu added the comment: > Did I do something wrong or do you need to allow me to push? Yes, I've added you to the collaborators on my fork (lulouie/cpython). But in fact, new GitHub workflow will need to do something different, not just edit-and-commit. You will need to go to PR 1382

[issue19903] Idle: Use inspect.signature for calltips

2017-05-04 Thread Terry J. Reedy
Terry J. Reedy added the comment: I pulled your pr, did some minor edits, committed, and tried to push back following this line from the devguide Bootcamp page. git push g...@github.com:/cpython : -- F:\dev\cpython>git commit -m "Fix and stop repeating invalid signature message"

[issue19903] Idle: Use inspect.signature for calltips

2017-05-03 Thread Terry J. Reedy
Terry J. Reedy added the comment: Later today I should be able to pull the PR to my machine to review and test, and recheck coverage change. -- ___ Python tracker

[issue19903] Idle: Use inspect.signature for calltips

2017-05-02 Thread Terry J. Reedy
Terry J. Reedy added the comment: I will try to do that when I can. -- ___ Python tracker ___ ___

[issue19903] Idle: Use inspect.signature for calltips

2017-05-02 Thread Louie Lu
Louie Lu added the comment: @Terry, the PR is created, it is now serving with signature. The two exception (object not callable, invalid method signature) will return the corresponding message. The only thing I didn't figure out it how to change the color, so I didn't test for this feature.

[issue19903] Idle: Use inspect.signature for calltips

2017-05-02 Thread Louie Lu
Changes by Louie Lu : -- pull_requests: +1490 ___ Python tracker ___ ___ Python-bugs-list

[issue19903] Idle: Use inspect.signature for calltips

2017-05-02 Thread Louie Lu
Louie Lu added the comment: ah, there are still some corner case about _first_param.sub(), some of them in signature will be like `(ci)`, not `(self, ci)`, and the regex will replace the first params to `()`, which is not correct. -- ___ Python

[issue19903] Idle: Use inspect.signature for calltips

2017-05-02 Thread Louie Lu
Louie Lu added the comment: Terry, only this case was failed, others in unittest work very well. -- ___ Python tracker ___

[issue19903] Idle: Use inspect.signature for calltips

2017-05-01 Thread Terry J. Reedy
Terry J. Reedy added the comment: Thanks for the report. As Yuri pointed out in msg292701, and I verified, c.m2() raises "TypeError: meth() takes 0 positional arguments but 1 was given". The purpose of get_argspec is to tell the user how to call the function without getting such a TypeError.

[issue19903] Idle: Use inspect.signature for calltips

2017-04-30 Thread Louie Lu
Louie Lu added the comment: I'm now testing to change getfullargspect to signature. It came out that signature can't accept bound method with only _VAR_KEYWORD. This test case will gave a ValueError: >>> class C: def m2(**kw): pass >>> c = C() >>>

[issue19903] Idle: Use inspect.signature for calltips

2017-02-25 Thread Terry J. Reedy
Terry J. Reedy added the comment: Several builtin functions have recently gotten the Arg clinic treatment. So I think it is now time to switch. Before closing #29653 as a duplicate, I discovered that inspect.signature also handles functools.partials correctly, while the other inspect

[issue19903] Idle: Use inspect.signature for calltips

2015-02-01 Thread Terry J. Reedy
Terry J. Reedy added the comment: The above suggests that the change might be applied to 3.4. The difference surprises me because #17481 patched getfullargspec() to 'use' signature() 'behind the scenes', so I expected the result to be the same. It seems that 'use' does not mean what I

[issue19903] Idle: Use inspect.signature for calltips

2015-02-01 Thread Terry J. Reedy
Terry J. Reedy added the comment: An example should make my concern clearer. str(signature(int)) is '()' because int (and all other builtins) has not been converted whereas the Idle calltip is int(x=0) - integer int(x, base=10) - integer I do not want to simply add a line with '()' to the

[issue19903] Idle: Use inspect.signature for calltips

2015-02-01 Thread Terry J. Reedy
Terry J. Reedy added the comment: .signature also handles wrapped functions better. def deco(f): import functools @functools.wraps(f) def ret(*args, **kw): return f(*args, **kw) return ret @deco def f(n, k): return n + k*2 import

[issue19903] Idle: Use inspect.signature for calltips

2014-12-09 Thread Yury Selivanov
Changes by Yury Selivanov yseliva...@gmail.com: -- versions: -Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19903 ___ ___

[issue19903] Idle: Use inspect.signature for calltips

2014-05-26 Thread Terry J. Reedy
Terry J. Reedy added the comment: My understanding is that when a builtin is converted, a) the docstring signature disappears, and b) getfullargspec calls str(signature). I need to check what now happens with .getfullargspec version .signature for uncoverted builtins and if any changes should

[issue19903] Idle: Use inspect.signature for calltips

2014-03-17 Thread Terry J. Reedy
Terry J. Reedy added the comment: I have not decided yet whether to apply to 3.4. -- versions: +Python 3.5 -Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19903 ___

[issue19903] Idle: Use inspect.signature for calltips

2014-02-24 Thread Yury Selivanov
Changes by Yury Selivanov yselivanov...@gmail.com: -- nosy: +yselivanov ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19903 ___ ___

[issue19903] Idle: Use inspect.signature for calltips

2014-01-26 Thread Terry J. Reedy
Changes by Terry J. Reedy tjre...@udel.edu: -- dependencies: +inspect.signature does not support new functools.partialmethod, inspect.signature removes initial starred method params (bug) ___ Python tracker rep...@bugs.python.org

[issue19903] Idle: Use inspect.signature for calltips

2014-01-22 Thread Terry J. Reedy
Terry J. Reedy added the comment: *17481 is about changing getargspec to use signature, at least as a backup. But that would not fix the example here. The calltips have been moved in 20122. -- ___ Python tracker rep...@bugs.python.org

[issue19903] Idle: Use inspect.signature for calltips

2014-01-04 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: -- dependencies: +Move CallTips tests to idle_tests ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19903 ___

[issue19903] Idle: Use inspect.signature for calltips

2013-12-05 Thread Terry J. Reedy
New submission from Terry J. Reedy: Change idlelib.CallTips.get_argspec to use inspect.signature, new in 3.3, instead of inspect.getfullargspec and inspect.formatargspec. One thing it handles better is a namedtuple class, which has a C-coded __init__ inherited from object a Python-coded