[issue30600] Error message incorrect when index is called with keyword argument ("[].index(x=2)")

2017-06-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The PR LGTM. Thank you for your contribution SylvainDe!

--
resolution:  -> fixed
stage: needs patch -> resolved
status: open -> closed
versions:  -Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30600] Error message incorrect when index is called with keyword argument ("[].index(x=2)")

2017-06-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset 7445381c606faf20e253da42656db478a4349f8e by Serhiy Storchaka 
(Sylvain) in branch 'master':
bpo-30600: Fix error messages (condition order in Argument Clinic) (#2051)
https://github.com/python/cpython/commit/7445381c606faf20e253da42656db478a4349f8e


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30600] Error message incorrect when index is called with keyword argument ("[].index(x=2)")

2017-06-09 Thread SylvainDe

Changes by SylvainDe :


--
pull_requests: +2113

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30600] Error message incorrect when index is called with keyword argument ("[].index(x=2)")

2017-06-09 Thread Jim Fasarakis-Hilliard

Changes by Jim Fasarakis-Hilliard :


--
nosy: +Jim Fasarakis-Hilliard

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30600] Error message incorrect when index is called with keyword argument ("[].index(x=2)")

2017-06-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This commit only exposed existing bug in Argument Clinic. The same bug should 
be exposed for other methods that takes no keyword arguments converted to 
Argument Clinic.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30600] Error message incorrect when index is called with keyword argument ("[].index(x=2)")

2017-06-09 Thread SylvainDe

SylvainDe added the comment:

Thanks Serhiy Storchaka for the tip! I am currently investigating how the 
argument clinic works. I have used git bisect to find when the issue got 
introduced.

commit fdd42c481edba4261f861fc1dfe24bbd79b5a17a
bpo-20185: Convert list object implementation to Argument Clinic. (#542)

--
Added file: http://bugs.python.org/file46939/git_bisect_bpo30600.txt

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30600] Error message incorrect when index is called with keyword argument ("[].index(x=2)")

2017-06-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Yes, pleas do this.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30600] Error message incorrect when index is called with keyword argument ("[].index(x=2)")

2017-06-08 Thread SylvainDe

SylvainDe added the comment:

Can I give this a try or is anyone working on this already ?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30600] Error message incorrect when index is called with keyword argument ("[].index(x=2)")

2017-06-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Good catch! This issue is similar to issue30534, but caused by generated code.

The solution is easy: make Argument Clinic (Tools/clinic/clinic.py) generating 
_PyArg_NoStackKeywords() before _PyArg_ParseStack() and regenerate all 
generated by Argument Clinic code (make clinic).

--
components: +Argument Clinic
keywords: +easy
nosy: +larry, serhiy.storchaka
stage:  -> needs patch
versions: +Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30600] Error message incorrect when index is called with keyword argument ("[].index(x=2)")

2017-06-08 Thread SylvainDe

New submission from SylvainDe:

Issue found while trying to write tests for  https://bugs.python.org/issue30592 
.

Issue related to http://bugs.python.org/issue30534 .

The following code:

[].index(x=2)

should raise the following error:

TypeError: index() takes no keyword arguments

but currently raises:

TypeError: index() takes at least 1 argument (0 given)


This is easily reproduced with the following unit test:

# AssertionError: "^index\(\) takes no keyword arguments$" does not match 
"index() takes at least 1 argument (0 given)"
def test_varargs4_kw(self):
msg = r"^index\(\) takes no keyword arguments$"
self.assertRaisesRegex(TypeError, msg, [].index, x=2)

--
components: Interpreter Core
messages: 295427
nosy: SylvainDe
priority: normal
severity: normal
status: open
title: Error message incorrect when index is called with keyword argument 
("[].index(x=2)")
type: behavior
versions: Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com