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
7b57c03a
Commit
7b57c03a
authored
Jul 05, 2019
by
Jeroen Demeyer
Committed by
Petr Viktorin
Jul 05, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-37151: remove _PyMethodDef_RawFastCall* functions (GH-14603)
parent
8fbeb143
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
273 deletions
+0
-273
Include/methodobject.h
Include/methodobject.h
+0
-14
Objects/call.c
Objects/call.c
+0
-259
No files found.
Include/methodobject.h
View file @
7b57c03a
...
...
@@ -95,20 +95,6 @@ typedef struct {
PyObject
*
m_weakreflist
;
/* List of weak references */
vectorcallfunc
vectorcall
;
}
PyCFunctionObject
;
PyAPI_FUNC
(
PyObject
*
)
_PyMethodDef_RawFastCallDict
(
PyMethodDef
*
method
,
PyObject
*
self
,
PyObject
*
const
*
args
,
Py_ssize_t
nargs
,
PyObject
*
kwargs
);
PyAPI_FUNC
(
PyObject
*
)
_PyMethodDef_RawFastCallKeywords
(
PyMethodDef
*
method
,
PyObject
*
self
,
PyObject
*
const
*
args
,
Py_ssize_t
nargs
,
PyObject
*
kwnames
);
#endif
PyAPI_FUNC
(
int
)
PyCFunction_ClearFreeList
(
void
);
...
...
Objects/call.c
View file @
7b57c03a
...
...
@@ -366,265 +366,6 @@ _PyFunction_Vectorcall(PyObject *func, PyObject* const* stack,
/* --- PyCFunction call functions --------------------------------- */
PyObject
*
_PyMethodDef_RawFastCallDict
(
PyMethodDef
*
method
,
PyObject
*
self
,
PyObject
*
const
*
args
,
Py_ssize_t
nargs
,
PyObject
*
kwargs
)
{
/* _PyMethodDef_RawFastCallDict() must not be called with an exception set,
because it can clear it (directly or indirectly) and so the
caller loses its exception */
assert
(
!
PyErr_Occurred
());
assert
(
method
!=
NULL
);
assert
(
nargs
>=
0
);
assert
(
nargs
==
0
||
args
!=
NULL
);
assert
(
kwargs
==
NULL
||
PyDict_Check
(
kwargs
));
PyCFunction
meth
=
method
->
ml_meth
;
int
flags
=
method
->
ml_flags
&
~
(
METH_CLASS
|
METH_STATIC
|
METH_COEXIST
);
PyObject
*
result
=
NULL
;
if
(
Py_EnterRecursiveCall
(
" while calling a Python object"
))
{
return
NULL
;
}
switch
(
flags
)
{
case
METH_NOARGS
:
if
(
kwargs
!=
NULL
&&
PyDict_GET_SIZE
(
kwargs
)
!=
0
)
{
goto
no_keyword_error
;
}
if
(
nargs
!=
0
)
{
PyErr_Format
(
PyExc_TypeError
,
"%.200s() takes no arguments (%zd given)"
,
method
->
ml_name
,
nargs
);
goto
exit
;
}
result
=
(
*
meth
)
(
self
,
NULL
);
break
;
case
METH_O
:
if
(
kwargs
!=
NULL
&&
PyDict_GET_SIZE
(
kwargs
)
!=
0
)
{
goto
no_keyword_error
;
}
if
(
nargs
!=
1
)
{
PyErr_Format
(
PyExc_TypeError
,
"%.200s() takes exactly one argument (%zd given)"
,
method
->
ml_name
,
nargs
);
goto
exit
;
}
result
=
(
*
meth
)
(
self
,
args
[
0
]);
break
;
case
METH_VARARGS
:
if
(
kwargs
!=
NULL
&&
PyDict_GET_SIZE
(
kwargs
)
!=
0
)
{
goto
no_keyword_error
;
}
/* fall through */
case
METH_VARARGS
|
METH_KEYWORDS
:
{
/* Slow-path: create a temporary tuple for positional arguments */
PyObject
*
argstuple
=
_PyTuple_FromArray
(
args
,
nargs
);
if
(
argstuple
==
NULL
)
{
goto
exit
;
}
if
(
flags
&
METH_KEYWORDS
)
{
result
=
(
*
(
PyCFunctionWithKeywords
)(
void
(
*
)(
void
))
meth
)
(
self
,
argstuple
,
kwargs
);
}
else
{
result
=
(
*
meth
)
(
self
,
argstuple
);
}
Py_DECREF
(
argstuple
);
break
;
}
case
METH_FASTCALL
:
{
if
(
kwargs
!=
NULL
&&
PyDict_GET_SIZE
(
kwargs
)
!=
0
)
{
goto
no_keyword_error
;
}
result
=
(
*
(
_PyCFunctionFast
)(
void
(
*
)(
void
))
meth
)
(
self
,
args
,
nargs
);
break
;
}
case
METH_FASTCALL
|
METH_KEYWORDS
:
{
_PyCFunctionFastWithKeywords
fastmeth
=
(
_PyCFunctionFastWithKeywords
)(
void
(
*
)(
void
))
meth
;
/* Fast path for no keywords */
if
(
kwargs
==
NULL
||
PyDict_GET_SIZE
(
kwargs
)
==
0
)
{
result
=
(
*
fastmeth
)
(
self
,
args
,
nargs
,
NULL
);
break
;
}
PyObject
*
const
*
stack
;
PyObject
*
kwnames
;
stack
=
_PyStack_UnpackDict
(
args
,
nargs
,
kwargs
,
&
kwnames
);
if
(
stack
==
NULL
)
{
goto
exit
;
}
result
=
(
*
fastmeth
)
(
self
,
stack
,
nargs
,
kwnames
);
_PyStack_UnpackDict_Free
(
stack
,
nargs
,
kwnames
);
break
;
}
default:
PyErr_SetString
(
PyExc_SystemError
,
"Bad call flags in _PyMethodDef_RawFastCallDict. "
"METH_OLDARGS is no longer supported!"
);
goto
exit
;
}
goto
exit
;
no_keyword_error:
PyErr_Format
(
PyExc_TypeError
,
"%.200s() takes no keyword arguments"
,
method
->
ml_name
);
exit:
Py_LeaveRecursiveCall
();
return
result
;
}
PyObject
*
_PyMethodDef_RawFastCallKeywords
(
PyMethodDef
*
method
,
PyObject
*
self
,
PyObject
*
const
*
args
,
Py_ssize_t
nargs
,
PyObject
*
kwnames
)
{
/* _PyMethodDef_RawFastCallKeywords() must not be called with an exception set,
because it can clear it (directly or indirectly) and so the
caller loses its exception */
assert
(
!
PyErr_Occurred
());
assert
(
method
!=
NULL
);
assert
(
nargs
>=
0
);
assert
(
kwnames
==
NULL
||
PyTuple_CheckExact
(
kwnames
));
/* kwnames must only contains str strings, no subclass, and all keys must
be unique */
PyCFunction
meth
=
method
->
ml_meth
;
int
flags
=
method
->
ml_flags
&
~
(
METH_CLASS
|
METH_STATIC
|
METH_COEXIST
);
Py_ssize_t
nkwargs
=
kwnames
==
NULL
?
0
:
PyTuple_GET_SIZE
(
kwnames
);
PyObject
*
result
=
NULL
;
if
(
Py_EnterRecursiveCall
(
" while calling a Python object"
))
{
return
NULL
;
}
switch
(
flags
)
{
case
METH_NOARGS
:
if
(
nkwargs
)
{
goto
no_keyword_error
;
}
if
(
nargs
!=
0
)
{
PyErr_Format
(
PyExc_TypeError
,
"%.200s() takes no arguments (%zd given)"
,
method
->
ml_name
,
nargs
);
goto
exit
;
}
result
=
(
*
meth
)
(
self
,
NULL
);
break
;
case
METH_O
:
if
(
nkwargs
)
{
goto
no_keyword_error
;
}
if
(
nargs
!=
1
)
{
PyErr_Format
(
PyExc_TypeError
,
"%.200s() takes exactly one argument (%zd given)"
,
method
->
ml_name
,
nargs
);
goto
exit
;
}
result
=
(
*
meth
)
(
self
,
args
[
0
]);
break
;
case
METH_FASTCALL
:
if
(
nkwargs
)
{
goto
no_keyword_error
;
}
result
=
((
_PyCFunctionFast
)(
void
(
*
)(
void
))
meth
)
(
self
,
args
,
nargs
);
break
;
case
METH_FASTCALL
|
METH_KEYWORDS
:
/* Fast-path: avoid temporary dict to pass keyword arguments */
result
=
((
_PyCFunctionFastWithKeywords
)(
void
(
*
)(
void
))
meth
)
(
self
,
args
,
nargs
,
kwnames
);
break
;
case
METH_VARARGS
:
if
(
nkwargs
)
{
goto
no_keyword_error
;
}
/* fall through */
case
METH_VARARGS
|
METH_KEYWORDS
:
{
/* Slow-path: create a temporary tuple for positional arguments
and a temporary dict for keyword arguments */
PyObject
*
argtuple
;
argtuple
=
_PyTuple_FromArray
(
args
,
nargs
);
if
(
argtuple
==
NULL
)
{
goto
exit
;
}
if
(
flags
&
METH_KEYWORDS
)
{
PyObject
*
kwdict
;
if
(
nkwargs
>
0
)
{
kwdict
=
_PyStack_AsDict
(
args
+
nargs
,
kwnames
);
if
(
kwdict
==
NULL
)
{
Py_DECREF
(
argtuple
);
goto
exit
;
}
}
else
{
kwdict
=
NULL
;
}
result
=
(
*
(
PyCFunctionWithKeywords
)(
void
(
*
)(
void
))
meth
)
(
self
,
argtuple
,
kwdict
);
Py_XDECREF
(
kwdict
);
}
else
{
result
=
(
*
meth
)
(
self
,
argtuple
);
}
Py_DECREF
(
argtuple
);
break
;
}
default:
PyErr_SetString
(
PyExc_SystemError
,
"Bad call flags in _PyMethodDef_RawFastCallKeywords. "
"METH_OLDARGS is no longer supported!"
);
goto
exit
;
}
goto
exit
;
no_keyword_error:
PyErr_Format
(
PyExc_TypeError
,
"%.200s() takes no keyword arguments"
,
method
->
ml_name
);
exit:
Py_LeaveRecursiveCall
();
return
result
;
}
static
PyObject
*
cfunction_call_varargs
(
PyObject
*
func
,
PyObject
*
args
,
PyObject
*
kwargs
)
{
...
...
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