Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
9648088e
Commit
9648088e
authored
Jul 09, 2017
by
Sylvain
Committed by
Serhiy Storchaka
Jul 09, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-30878: Fix error message when keyword arguments are passed (#2635)
to staticmethod() and classmethod().
parent
aa6a4d6e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
4 deletions
+12
-4
Lib/test/test_call.py
Lib/test/test_call.py
+8
-0
Objects/funcobject.c
Objects/funcobject.c
+4
-4
No files found.
Lib/test/test_call.py
View file @
9648088e
...
...
@@ -186,6 +186,14 @@ class CFunctionCallsErrorMessages(unittest.TestCase):
msg = r"
^
pack
\
(
\
)
takes
no
keyword
arguments
$
"
self.assertRaisesRegex(TypeError, msg, struct.Struct.pack, struct.Struct(""), x=2)
def test_varargs12_kw(self):
msg = r"
^
staticmethod
\
(
\
)
takes
no
keyword
arguments
$
"
self.assertRaisesRegex(TypeError, msg, staticmethod, func=id)
def test_varargs13_kw(self):
msg = r"
^
classmethod
\
(
\
)
takes
no
keyword
arguments
$
"
self.assertRaisesRegex(TypeError, msg, classmethod, func=id)
def test_oldargs0_1(self):
msg = r"
keys
\
(
\
)
takes
no
arguments
\
(
1
given
\
)
"
self.assertRaisesRegex(TypeError, msg, {}.keys, 0)
...
...
Objects/funcobject.c
View file @
9648088e
...
...
@@ -702,10 +702,10 @@ cm_init(PyObject *self, PyObject *args, PyObject *kwds)
classmethod
*
cm
=
(
classmethod
*
)
self
;
PyObject
*
callable
;
if
(
!
PyArg_UnpackTuple
(
args
,
"classmethod"
,
1
,
1
,
&
callable
))
return
-
1
;
if
(
!
_PyArg_NoKeywords
(
"classmethod"
,
kwds
))
return
-
1
;
if
(
!
PyArg_UnpackTuple
(
args
,
"classmethod"
,
1
,
1
,
&
callable
))
return
-
1
;
Py_INCREF
(
callable
);
cm
->
cm_callable
=
callable
;
return
0
;
...
...
@@ -883,10 +883,10 @@ sm_init(PyObject *self, PyObject *args, PyObject *kwds)
staticmethod
*
sm
=
(
staticmethod
*
)
self
;
PyObject
*
callable
;
if
(
!
PyArg_UnpackTuple
(
args
,
"staticmethod"
,
1
,
1
,
&
callable
))
return
-
1
;
if
(
!
_PyArg_NoKeywords
(
"staticmethod"
,
kwds
))
return
-
1
;
if
(
!
PyArg_UnpackTuple
(
args
,
"staticmethod"
,
1
,
1
,
&
callable
))
return
-
1
;
Py_INCREF
(
callable
);
sm
->
sm_callable
=
callable
;
return
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment