Skip to content

Commit

Permalink
Fix "__Pyx_PyObject_AsDouble()" special-casing to prevent de-optimisa…
Browse files Browse the repository at this point in the history
…tion through potential PyFloat unpack-repack cycles.
  • Loading branch information
scoder committed Nov 20, 2020
1 parent ef95d35 commit 1733694
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Cython/Compiler/Optimize.py
Original file line number Diff line number Diff line change
Expand Up @@ -2189,7 +2189,7 @@ def visit_CoerceToPyTypeNode(self, node):
func_arg = arg.args[0]
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'")
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(
node.pos, '__Pyx_PyNumber_Float', self.PyNumber_Float_func_type,
args=[func_arg],
Expand Down

0 comments on commit 1733694

Please sign in to comment.