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
e90bdb19
Commit
e90bdb19
authored
Aug 25, 2016
by
Victor Stinner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #27830: Revert, remove _PyFunction_FastCallKeywords()
parent
bb108591
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
74 deletions
+6
-74
Include/abstract.h
Include/abstract.h
+0
-17
Include/funcobject.h
Include/funcobject.h
+0
-6
Objects/abstract.c
Objects/abstract.c
+0
-45
Python/ceval.c
Python/ceval.c
+6
-6
No files found.
Include/abstract.h
View file @
e90bdb19
...
...
@@ -292,23 +292,6 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
#define _PyObject_CallArg1(func, arg) \
_PyObject_FastCall((func), &(arg), 1)
/* Call the callable object func with the "fast call" calling convention:
args is a C array for positional arguments followed by (key, value)
pairs for keyword arguments.
nargs is the number of positional parameters at the beginning of stack.
nkwargs is the number of (key, value) pairs at the end of stack.
If nargs and nkwargs are equal to zero, stack can be NULL.
Return the result on success. Raise an exception and return NULL on
error. */
PyAPI_FUNC
(
PyObject
*
)
_PyObject_FastCallKeywords
(
PyObject
*
func
,
PyObject
**
stack
,
Py_ssize_t
nargs
,
Py_ssize_t
nkwargs
);
PyAPI_FUNC
(
PyObject
*
)
_PyObject_Call_Prepend
(
PyObject
*
func
,
PyObject
*
obj
,
PyObject
*
args
,
PyObject
*
kwargs
);
...
...
Include/funcobject.h
View file @
e90bdb19
...
...
@@ -64,12 +64,6 @@ PyAPI_FUNC(PyObject *) _PyFunction_FastCallDict(
PyObject
**
args
,
Py_ssize_t
nargs
,
PyObject
*
kwargs
);
PyAPI_FUNC
(
PyObject
*
)
_PyFunction_FastCallKeywords
(
PyObject
*
func
,
PyObject
**
stack
,
Py_ssize_t
nargs
,
Py_ssize_t
nkwargs
);
#endif
/* Macros for direct access to these values. Type checks are *not*
...
...
Objects/abstract.c
View file @
e90bdb19
...
...
@@ -2343,51 +2343,6 @@ _PyStack_AsDict(PyObject **stack, Py_ssize_t nkwargs, PyObject *func)
return
kwdict
;
}
PyObject
*
_PyObject_FastCallKeywords
(
PyObject
*
func
,
PyObject
**
stack
,
Py_ssize_t
nargs
,
Py_ssize_t
nkwargs
)
{
PyObject
*
args
,
*
kwdict
,
*
result
;
/* _PyObject_FastCallKeywords() must not be called with an exception set,
because it may clear it (directly or indirectly) and so the
caller loses its exception */
assert
(
!
PyErr_Occurred
());
assert
(
func
!=
NULL
);
assert
(
nargs
>=
0
);
assert
(
nkwargs
>=
0
);
assert
((
nargs
==
0
&&
nkwargs
==
0
)
||
stack
!=
NULL
);
if
(
PyFunction_Check
(
func
))
{
/* Fast-path: avoid temporary tuple or dict */
return
_PyFunction_FastCallKeywords
(
func
,
stack
,
nargs
,
nkwargs
);
}
if
(
PyCFunction_Check
(
func
)
&&
nkwargs
==
0
)
{
return
_PyCFunction_FastCallDict
(
func
,
stack
,
nargs
,
NULL
);
}
/* Slow-path: build temporary tuple and/or dict */
args
=
_PyStack_AsTuple
(
stack
,
nargs
);
if
(
nkwargs
>
0
)
{
kwdict
=
_PyStack_AsDict
(
stack
+
nargs
,
nkwargs
,
func
);
if
(
kwdict
==
NULL
)
{
Py_DECREF
(
args
);
return
NULL
;
}
}
else
{
kwdict
=
NULL
;
}
result
=
PyObject_Call
(
func
,
args
,
kwdict
);
Py_DECREF
(
args
);
Py_XDECREF
(
kwdict
);
return
result
;
}
/* Positional arguments are obj followed args. */
PyObject
*
_PyObject_Call_Prepend
(
PyObject
*
func
,
...
...
Python/ceval.c
View file @
e90bdb19
...
...
@@ -113,6 +113,7 @@ static PyObject * call_function(PyObject ***, int, uint64*, uint64*);
#else
static
PyObject
*
call_function
(
PyObject
***
,
int
);
#endif
static
PyObject
*
fast_function
(
PyObject
*
,
PyObject
**
,
Py_ssize_t
,
Py_ssize_t
);
static
PyObject
*
do_call
(
PyObject
*
,
PyObject
***
,
Py_ssize_t
,
Py_ssize_t
);
static
PyObject
*
ext_do_call
(
PyObject
*
,
PyObject
***
,
int
,
Py_ssize_t
,
Py_ssize_t
);
static
PyObject
*
update_keyword_args
(
PyObject
*
,
Py_ssize_t
,
PyObject
***
,
...
...
@@ -4766,7 +4767,7 @@ call_function(PyObject ***pp_stack, int oparg
}
READ_TIMESTAMP
(
*
pintr0
);
if
(
PyFunction_Check
(
func
))
{
x
=
_PyFunction_FastCallKeywords
(
func
,
(
*
pp_stack
)
-
n
,
nargs
,
nkwargs
);
x
=
fast_function
(
func
,
(
*
pp_stack
)
-
n
,
nargs
,
nkwargs
);
}
else
{
x
=
do_call
(
func
,
pp_stack
,
nargs
,
nkwargs
);
...
...
@@ -4779,7 +4780,7 @@ call_function(PyObject ***pp_stack, int oparg
/* Clear the stack of the function object. Also removes
the arguments in case they weren't consumed already
(
_PyFunction_FastCallKeywords
() and err_args() leave them on the stack).
(
fast_function
() and err_args() leave them on the stack).
*/
while
((
*
pp_stack
)
>
pfunc
)
{
w
=
EXT_POP
(
*
pp_stack
);
...
...
@@ -4791,7 +4792,7 @@ call_function(PyObject ***pp_stack, int oparg
return
x
;
}
/* The
_PyFunction_FastCallKeywords
() function optimize calls for which no argument
/* The
fast_function
() function optimize calls for which no argument
tuple is necessary; the objects are passed directly from the stack.
For the simplest case -- a function that takes only positional
arguments and is called with only positional arguments -- it
...
...
@@ -4839,9 +4840,8 @@ _PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t nargs,
/* Similar to _PyFunction_FastCall() but keywords are passed a (key, value)
pairs in stack */
PyObject
*
_PyFunction_FastCallKeywords
(
PyObject
*
func
,
PyObject
**
stack
,
Py_ssize_t
nargs
,
Py_ssize_t
nkwargs
)
static
PyObject
*
fast_function
(
PyObject
*
func
,
PyObject
**
stack
,
Py_ssize_t
nargs
,
Py_ssize_t
nkwargs
)
{
PyCodeObject
*
co
=
(
PyCodeObject
*
)
PyFunction_GET_CODE
(
func
);
PyObject
*
globals
=
PyFunction_GET_GLOBALS
(
func
);
...
...
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