[issue40679] show class name in method invocation TypeError

2020-06-04 Thread STINNER Victor
STINNER Victor added the comment: > Thanks a lot, Victor. You're welcome. Using the qualified name instead of the "short" name in error messages is nice enhancement! -- resolution: -> fixed stage: patch review -> resolved status: open -> closed

[issue40679] show class name in method invocation TypeError

2020-06-04 Thread STINNER Victor
STINNER Victor added the comment: New changeset 232dda6cbc10860328a83517a6e3ea238ff4147f by Victor Stinner in branch 'master': bpo-40679: Fix _PyEval_EvalCode() crash if qualname is NULL (GH-20615) https://github.com/python/cpython/commit/232dda6cbc10860328a83517a6e3ea238ff4147f --

[issue40679] show class name in method invocation TypeError

2020-06-03 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +19841 pull_request: https://github.com/python/cpython/pull/20615 ___ Python tracker ___

[issue40679] show class name in method invocation TypeError

2020-06-03 Thread Chris Jerdonek
Chris Jerdonek added the comment: Thanks a lot, Victor. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue40679] show class name in method invocation TypeError

2020-06-03 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +19834 stage: resolved -> patch review pull_request: https://github.com/python/cpython/pull/20606 ___ Python tracker ___

[issue40679] show class name in method invocation TypeError

2020-06-03 Thread STINNER Victor
STINNER Victor added the comment: > bpo-40679: Use the function's qualname in certain TypeErrors (GH-20236) This change introduced a regression. See this bug in Cython: https://github.com/cython/cython/issues/3641#issuecomment-638102096 I wrote a PR to use co->co_name if qualname is NULL

[issue40679] show class name in method invocation TypeError

2020-05-22 Thread Chris Jerdonek
Chris Jerdonek added the comment: > _PyObject_FunctionString as discussed here ( > https://bugs.python.org/issue37645 ) returns a string that also includes the > module name where applicable. By the way, Dennis, regarding the above, one thing I noticed is that Python doesn't currently

[issue40679] show class name in method invocation TypeError

2020-05-22 Thread Chris Jerdonek
Chris Jerdonek added the comment: Thanks again, Dennis! -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue40679] show class name in method invocation TypeError

2020-05-22 Thread Chris Jerdonek
Chris Jerdonek added the comment: New changeset b5cc2089cc354469f12eabc7ba54280e85fdd6dc by Dennis Sweeney in branch 'master': bpo-40679: Use the function's qualname in certain TypeErrors (GH-20236) https://github.com/python/cpython/commit/b5cc2089cc354469f12eabc7ba54280e85fdd6dc

[issue40679] show class name in method invocation TypeError

2020-05-21 Thread Chris Jerdonek
Change by Chris Jerdonek : -- components: +Interpreter Core versions: +Python 3.10 -Python 3.9 ___ Python tracker ___ ___

[issue40679] show class name in method invocation TypeError

2020-05-21 Thread Dennis Sweeney
Dennis Sweeney added the comment: https://bugs.python.org/issue40706 -- ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue40679] show class name in method invocation TypeError

2020-05-20 Thread Dennis Sweeney
Dennis Sweeney added the comment: Sure -- I'll file the issue. -- ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue40679] show class name in method invocation TypeError

2020-05-20 Thread Chris Jerdonek
Chris Jerdonek added the comment: > So maybe the test coverage (or removal?) should be a separate issue. That sounds good. Want to file the issue? -- ___ Python tracker ___

[issue40679] show class name in method invocation TypeError

2020-05-20 Thread Dennis Sweeney
Dennis Sweeney added the comment: I just ran the entire test suite with: --- a/Python/ceval.c +++ b/Python/ceval.c @@ -4179,6 +4179,7 @@ _PyEval_EvalCode(PyThreadState *tstate, Py_ssize_t j; if (keyword == NULL || !PyUnicode_Check(keyword)) { +printf("THIS CODE

[issue40679] show class name in method invocation TypeError

2020-05-20 Thread Chris Jerdonek
Chris Jerdonek added the comment: Oh, that string is used in even more spots (sorry wasn't looking too closely the first time). -- ___ Python tracker ___

[issue40679] show class name in method invocation TypeError

2020-05-20 Thread Dennis Sweeney
Dennis Sweeney added the comment: Never mind; I think you're right, and https://github.com/python/cpython/blob/master/Objects/call.c#L1009 is the line. -- ___ Python tracker

[issue40679] show class name in method invocation TypeError

2020-05-20 Thread Dennis Sweeney
Dennis Sweeney added the comment: I got this: >>> class A: ... def f(): ... pass ... >>> A.f(1) Traceback (most recent call last): File "", line 1, in TypeError: A.f() takes 0 positional arguments but 1 was given >>> A.f(**{1:2}) Traceback (most recent call last): File "", line 1, in

[issue40679] show class name in method invocation TypeError

2020-05-20 Thread Chris Jerdonek
Chris Jerdonek added the comment: Oh, I see now I was hitting a different line: https://github.com/python/cpython/blob/master/Objects/call.c#L1009 Maybe my suggestion is enough to help you (I didn't really look closely at the code), or maybe you were already aware of that. --

[issue40679] show class name in method invocation TypeError

2020-05-20 Thread Chris Jerdonek
Chris Jerdonek added the comment: > Or should we be satisfied with the half-measure of including the qualname but > not the module (at least for now)? This is something I was wondering myself, too (also for other contexts). Let's take things one step at a time and limit ourselves just to

[issue40679] show class name in method invocation TypeError

2020-05-20 Thread Dennis Sweeney
Dennis Sweeney added the comment: While trying to write tests, I stumbled across something interesting: _PyObject_FunctionString as discussed here ( https://bugs.python.org/issue37645 ) returns a string that also includes the module name where applicable. For example, the module name is

[issue40679] show class name in method invocation TypeError

2020-05-19 Thread Chris Jerdonek
Chris Jerdonek added the comment: Thanks! I think it does. Also, I see now that using the __qualname__ is better than including the object's type for locating the method because you can have cases like super().foo() or even-- class A: def foo(self): pass def bar(): pass

[issue40679] show class name in method invocation TypeError

2020-05-19 Thread Dennis Sweeney
Dennis Sweeney added the comment: The attached PR isn't exactly what you requested, but it's a very minimal code change that uses the existing __qualname__ functionality to change the message to TypeError: A.foo() takes 1 positional argument but 2 were given Does that address those

[issue40679] show class name in method invocation TypeError

2020-05-19 Thread Dennis Sweeney
Change by Dennis Sweeney : -- keywords: +patch nosy: +Dennis Sweeney nosy_count: 2.0 -> 3.0 pull_requests: +19523 stage: -> patch review pull_request: https://github.com/python/cpython/pull/20236 ___ Python tracker

[issue40679] show class name in method invocation TypeError

2020-05-19 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +xtreak ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue40679] show class name in method invocation TypeError

2020-05-19 Thread Chris Jerdonek
New submission from Chris Jerdonek : When calling an instance method incorrectly, you will often get a TypeError that is some variation of the following: Traceback (most recent call last): File "/.../test.py", line 6, in a.foo(1) TypeError: foo() takes 1 positional