Skip to content

Commit

Permalink
Use a temporary for non-trivial conditions in conditional expressions…
Browse files Browse the repository at this point in the history
…. This avoids generating duplicate parentheses in condition code and aligns the code generated for conditional expressions with that for if-statements.

Closes #5555
Closes #5587
  • Loading branch information
scoder committed Aug 4, 2023
1 parent b4671ba commit f1d52e6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Cython/Compiler/ExprNodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -12800,7 +12800,7 @@ def is_ephemeral(self):
return self.true_val.is_ephemeral() or self.false_val.is_ephemeral()

def analyse_types(self, env):
self.test = self.test.analyse_types(env).coerce_to_boolean(env)
self.test = self.test.analyse_temp_boolean_expression(env)
self.true_val = self.true_val.analyse_types(env)
self.false_val = self.false_val.analyse_types(env)
return self.analyse_result_type(env)
Expand Down

0 comments on commit f1d52e6

Please sign in to comment.