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
684fd0c8
Commit
684fd0c8
authored
May 25, 2006
by
Georg Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace PyObject_CallFunction calls with only object args
with PyObject_CallFunctionObjArgs, which is 30% faster.
parent
3b0cae9c
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
17 additions
and
20 deletions
+17
-20
Modules/cPickle.c
Modules/cPickle.c
+2
-2
Modules/gcmodule.c
Modules/gcmodule.c
+1
-1
Modules/parsermodule.c
Modules/parsermodule.c
+2
-2
Objects/classobject.c
Objects/classobject.c
+2
-5
Objects/typeobject.c
Objects/typeobject.c
+5
-5
Objects/weakrefobject.c
Objects/weakrefobject.c
+1
-1
Python/ceval.c
Python/ceval.c
+1
-1
Python/import.c
Python/import.c
+3
-3
No files found.
Modules/cPickle.c
View file @
684fd0c8
...
...
@@ -3073,8 +3073,8 @@ find_class(PyObject *py_module_name, PyObject *py_global_name, PyObject *fc)
"pickles are not supported."
);
return
NULL
;
}
return
PyObject_CallFunction
(
fc
,
"OO"
,
py_module_name
,
py_global_name
);
return
PyObject_CallFunction
ObjArgs
(
fc
,
py_module_name
,
py_global_name
,
NULL
);
}
module
=
PySys_GetObject
(
"modules"
);
...
...
Modules/gcmodule.c
View file @
684fd0c8
...
...
@@ -603,7 +603,7 @@ handle_weakrefs(PyGC_Head *unreachable, PyGC_Head *old)
assert
(
callback
!=
NULL
);
/* copy-paste of weakrefobject.c's handle_callback() */
temp
=
PyObject_CallFunction
(
callback
,
"O"
,
wr
);
temp
=
PyObject_CallFunction
ObjArgs
(
callback
,
wr
,
NULL
);
if
(
temp
==
NULL
)
PyErr_WriteUnraisable
(
callback
);
else
...
...
Modules/parsermodule.c
View file @
684fd0c8
...
...
@@ -3267,8 +3267,8 @@ initparser(void)
&&
(
pickler
!=
NULL
))
{
PyObject
*
res
;
res
=
PyObject_CallFunction
(
func
,
"OOO"
,
&
PyST_Type
,
pickler
,
pickle_constructor
);
res
=
PyObject_CallFunction
ObjArgs
(
func
,
&
PyST_Type
,
pickler
,
pickle_constructor
,
NULL
);
Py_XDECREF
(
res
);
}
Py_XDECREF
(
func
);
...
...
Objects/classobject.c
View file @
684fd0c8
...
...
@@ -81,12 +81,9 @@ PyClass_New(PyObject *bases, PyObject *dict, PyObject *name)
if
(
!
PyClass_Check
(
base
))
{
if
(
PyCallable_Check
(
(
PyObject
*
)
base
->
ob_type
))
return
PyObject_CallFunction
(
return
PyObject_CallFunction
ObjArgs
(
(
PyObject
*
)
base
->
ob_type
,
"OOO"
,
name
,
bases
,
dict
);
name
,
bases
,
dict
,
NULL
);
PyErr_SetString
(
PyExc_TypeError
,
"PyClass_New: base must be a class"
);
return
NULL
;
...
...
Objects/typeobject.c
View file @
684fd0c8
...
...
@@ -4641,10 +4641,10 @@ slot_tp_getattr_hook(PyObject *self, PyObject *name)
(
void
*
)
PyObject_GenericGetAttr
))
res
=
PyObject_GenericGetAttr
(
self
,
name
);
else
res
=
PyObject_CallFunction
(
getattribute
,
"OO"
,
self
,
name
);
res
=
PyObject_CallFunction
ObjArgs
(
getattribute
,
self
,
name
,
NULL
);
if
(
res
==
NULL
&&
PyErr_ExceptionMatches
(
PyExc_AttributeError
))
{
PyErr_Clear
();
res
=
PyObject_CallFunction
(
getattr
,
"OO"
,
self
,
name
);
res
=
PyObject_CallFunction
ObjArgs
(
getattr
,
self
,
name
,
NULL
);
}
return
res
;
}
...
...
@@ -4781,7 +4781,7 @@ slot_tp_descr_get(PyObject *self, PyObject *obj, PyObject *type)
obj
=
Py_None
;
if
(
type
==
NULL
)
type
=
Py_None
;
return
PyObject_CallFunction
(
get
,
"OOO"
,
self
,
obj
,
type
);
return
PyObject_CallFunction
ObjArgs
(
get
,
self
,
obj
,
type
,
NULL
);
}
static
int
...
...
@@ -5728,8 +5728,8 @@ super_descr_get(PyObject *self, PyObject *obj, PyObject *type)
if
(
su
->
ob_type
!=
&
PySuper_Type
)
/* If su is an instance of a (strict) subclass of super,
call its type */
return
PyObject_CallFunction
((
PyObject
*
)
su
->
ob_type
,
"OO"
,
su
->
type
,
obj
);
return
PyObject_CallFunction
ObjArgs
((
PyObject
*
)
su
->
ob_type
,
su
->
type
,
obj
,
NULL
);
else
{
/* Inline the common case */
PyTypeObject
*
obj_type
=
supercheck
(
su
->
type
,
obj
);
...
...
Objects/weakrefobject.c
View file @
684fd0c8
...
...
@@ -851,7 +851,7 @@ PyWeakref_GetObject(PyObject *ref)
static
void
handle_callback
(
PyWeakReference
*
ref
,
PyObject
*
callback
)
{
PyObject
*
cbresult
=
PyObject_CallFunction
(
callback
,
"O"
,
ref
);
PyObject
*
cbresult
=
PyObject_CallFunction
ObjArgs
(
callback
,
ref
,
NULL
);
if
(
cbresult
==
NULL
)
PyErr_WriteUnraisable
(
callback
);
...
...
Python/ceval.c
View file @
684fd0c8
...
...
@@ -4053,7 +4053,7 @@ build_class(PyObject *methods, PyObject *bases, PyObject *name)
metaclass
=
(
PyObject
*
)
&
PyClass_Type
;
Py_INCREF
(
metaclass
);
}
result
=
PyObject_CallFunction
(
metaclass
,
"OOO"
,
name
,
bases
,
methods
);
result
=
PyObject_CallFunction
ObjArgs
(
metaclass
,
name
,
bases
,
methods
,
NULL
);
Py_DECREF
(
metaclass
);
if
(
result
==
NULL
&&
PyErr_ExceptionMatches
(
PyExc_TypeError
))
{
/* A type error here likely means that the user passed
...
...
Python/import.c
View file @
684fd0c8
...
...
@@ -1043,7 +1043,7 @@ get_path_importer(PyObject *path_importer_cache, PyObject *path_hooks,
PyObject
*
hook
=
PyList_GetItem
(
path_hooks
,
j
);
if
(
hook
==
NULL
)
return
NULL
;
importer
=
PyObject_CallFunction
(
hook
,
"O"
,
p
);
importer
=
PyObject_CallFunction
ObjArgs
(
hook
,
p
,
NULL
);
if
(
importer
!=
NULL
)
break
;
...
...
@@ -2499,8 +2499,8 @@ PyImport_Import(PyObject *module_name)
goto
err
;
/* Call the _import__ function with the proper argument list */
r
=
PyObject_CallFunction
(
import
,
"OOOO"
,
module_name
,
globals
,
globals
,
silly_list
);
r
=
PyObject_CallFunction
ObjArgs
(
import
,
module_name
,
globals
,
globals
,
silly_list
,
NULL
);
err:
Py_XDECREF
(
globals
);
...
...
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