[issue30878] The staticmethod doesn't properly reject keyword arguments

2017-07-09 Thread SylvainDe

SylvainDe added the comment:

Thanks Serhiy Storchaka !

This issue seems to affect (all) other Python versions. Should we proceed to a 
cherry-pick ?

--

___
Python tracker 

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



[issue30878] The staticmethod doesn't properly reject keyword arguments

2017-07-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you for your report Kay and thank you for your patch SylvainDe.

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

___
Python tracker 

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



[issue30878] The staticmethod doesn't properly reject keyword arguments

2017-07-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset 9648088e6ccd6d0cc04f450f55628fd8eda3784c by Serhiy Storchaka 
(Sylvain) in branch 'master':
bpo-30878: Fix error message when keyword arguments are passed (#2635)
https://github.com/python/cpython/commit/9648088e6ccd6d0cc04f450f55628fd8eda3784c


--

___
Python tracker 

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



[issue30878] The staticmethod doesn't properly reject keyword arguments

2017-07-08 Thread SylvainDe

Changes by SylvainDe :


--
pull_requests: +2700

___
Python tracker 

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



[issue30878] The staticmethod doesn't properly reject keyword arguments

2017-07-08 Thread SylvainDe

SylvainDe added the comment:

I have a fix ready but I'll look if other functions using _PyArg_NoKeywords may 
have the same defect before submitting it.

--

___
Python tracker 

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



[issue30878] The staticmethod doesn't properly reject keyword arguments

2017-07-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This is similar to recently fixed issue30534 and issue30627. The solution is 
simple as for issue30627.

--
keywords: +easy (C)
nosy: +SylvainDe, serhiy.storchaka
stage:  -> needs patch
type:  -> enhancement
versions: +Python 3.7 -Python 3.6

___
Python tracker 

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



[issue30878] The staticmethod doesn't properly reject keyword arguments

2017-07-08 Thread Kay Hayen

New submission from Kay Hayen:

Check out this:

python3.6 -c "staticmethod(function=1)"
Traceback (most recent call last):
  File "", line 1, in 
TypeError: staticmethod expected 1 arguments, got 0

python3.6 -c "staticmethod()"
Traceback (most recent call last):
  File "", line 1, in 
TypeError: staticmethod expected 1 arguments, got 0

python3.6 -c "staticmethod(f=1)"
Traceback (most recent call last):
  File "", line 1, in 
TypeError: staticmethod expected 1 arguments, got 0

I believe Python 2.7 behaves the same.

What should happen is more like this:

python3.6 -c "range(f=1)"
Traceback (most recent call last):
  File "", line 1, in 
TypeError: range() does not take keyword arguments

While statically optimizing, I came across this as a first. At least 
"classmethod" behaves the same. I suppose it is because these are not intended 
for manual use anymore.

I would recommend to fix up the argument parsing to either indicate its 
rejection of keyword arguments, or to accept "function = " for input 
(preferred).

Thanks,
Kay Hayen

--
components: Interpreter Core
messages: 297946
nosy: kayhayen
priority: normal
severity: normal
status: open
title: The staticmethod doesn't properly reject keyword arguments
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