Commit 150759db authored by Stefan Behnel's avatar Stefan Behnel

Reorder a condition to make it clearer to read by avoiding the negation.

parent ee7ae0b9
...@@ -9371,17 +9371,18 @@ class PyCFunctionNode(ExprNode, ModuleNameMixin): ...@@ -9371,17 +9371,18 @@ class PyCFunctionNode(ExprNode, ModuleNameMixin):
# so their optional arguments must be static, too. # so their optional arguments must be static, too.
# TODO: change CyFunction implementation to pass both function object and owning object for method calls # TODO: change CyFunction implementation to pass both function object and owning object for method calls
must_use_constants = env.is_c_class_scope or (self.def_node.is_wrapper and env.is_module_scope) must_use_constants = env.is_c_class_scope or (self.def_node.is_wrapper and env.is_module_scope)
for arg in self.def_node.args: for arg in self.def_node.args:
if arg.default: if arg.default:
if not must_use_constants: if not must_use_constants:
if not arg.default.is_literal: if arg.default.is_literal:
arg.default = DefaultLiteralArgNode(arg.pos, arg.default)
else:
arg.is_dynamic = True arg.is_dynamic = True
if arg.type.is_pyobject: if arg.type.is_pyobject:
nonliteral_objects.append(arg) nonliteral_objects.append(arg)
else: else:
nonliteral_other.append(arg) nonliteral_other.append(arg)
else:
arg.default = DefaultLiteralArgNode(arg.pos, arg.default)
if arg.default.type and arg.default.type.can_coerce_to_pyobject(env): if arg.default.type and arg.default.type.can_coerce_to_pyobject(env):
if arg.kw_only: if arg.kw_only:
default_kwargs.append(arg) default_kwargs.append(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