Commit f669064a authored by Stefan Behnel's avatar Stefan Behnel

use PyObject_Call() instead of _CallObject() just as Python calls it...

use PyObject_Call() instead of _CallObject() just as Python calls it internally, speedup of about 5%
parent c195bea0
...@@ -1478,11 +1478,8 @@ class SimpleCallNode(ExprNode): ...@@ -1478,11 +1478,8 @@ class SimpleCallNode(ExprNode):
function.obj = CloneNode(self.self) function.obj = CloneNode(self.self)
func_type = self.function_type() func_type = self.function_type()
if func_type.is_pyobject: if func_type.is_pyobject:
if self.args: self.arg_tuple = TupleNode(self.pos, args = self.args)
self.arg_tuple = TupleNode(self.pos, args = self.args) self.arg_tuple.analyse_types(env)
self.arg_tuple.analyse_types(env)
else:
self.arg_tuple = None
self.args = None self.args = None
self.type = py_object_type self.type = py_object_type
self.is_temp = 1 self.is_temp = 1
...@@ -1573,12 +1570,9 @@ class SimpleCallNode(ExprNode): ...@@ -1573,12 +1570,9 @@ class SimpleCallNode(ExprNode):
def generate_result_code(self, code): def generate_result_code(self, code):
func_type = self.function_type() func_type = self.function_type()
if func_type.is_pyobject: if func_type.is_pyobject:
if self.arg_tuple: arg_code = self.arg_tuple.py_result()
arg_code = self.arg_tuple.py_result()
else:
arg_code = "0"
code.putln( code.putln(
"%s = PyObject_CallObject(%s, %s); %s" % ( "%s = PyObject_Call(%s, %s, NULL); %s" % (
self.result_code, self.result_code,
self.function.py_result(), self.function.py_result(),
arg_code, arg_code,
...@@ -1663,7 +1657,7 @@ class GeneralCallNode(ExprNode): ...@@ -1663,7 +1657,7 @@ class GeneralCallNode(ExprNode):
else: else:
keyword_code = None keyword_code = None
if not keyword_code: if not keyword_code:
call_code = "PyObject_CallObject(%s, %s)" % ( call_code = "PyObject_Call(%s, %s, NULL)" % (
self.function.py_result(), self.function.py_result(),
self.positional_args.py_result()) self.positional_args.py_result())
else: else:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment