Commit 17336946 authored by Stefan Behnel's avatar Stefan Behnel

Fix "__Pyx_PyObject_AsDouble()" special-casing to prevent de-optimisation...

Fix "__Pyx_PyObject_AsDouble()" special-casing to prevent de-optimisation through potential PyFloat unpack-repack cycles.
parent ef95d354
...@@ -2189,7 +2189,7 @@ class OptimizeBuiltinCalls(Visitor.NodeRefCleanupMixin, ...@@ -2189,7 +2189,7 @@ class OptimizeBuiltinCalls(Visitor.NodeRefCleanupMixin,
func_arg = arg.args[0] func_arg = arg.args[0]
if func_arg.type is Builtin.float_type: if func_arg.type is Builtin.float_type:
return func_arg.as_none_safe_node("float() argument must be a string or a number, not 'NoneType'") return func_arg.as_none_safe_node("float() argument must be a string or a number, not 'NoneType'")
elif func_arg.type.is_pyobject and arg.function.cname == "__Pyx__PyObject_AsDouble": elif func_arg.type.is_pyobject and arg.function.cname == "__Pyx_PyObject_AsDouble":
return ExprNodes.PythonCapiCallNode( return ExprNodes.PythonCapiCallNode(
node.pos, '__Pyx_PyNumber_Float', self.PyNumber_Float_func_type, node.pos, '__Pyx_PyNumber_Float', self.PyNumber_Float_func_type,
args=[func_arg], args=[func_arg],
......
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