Skip to content

Commit

Permalink
Disallow cpp_locals and boolean binary operators (cython#6376)
Browse files Browse the repository at this point in the history
It looks very difficult to handle correctly, so I'm not sure
it's worth the complication. A clean error message is better than
a compiler crash.

One part of cython#6370
  • Loading branch information
da-woods authored Sep 14, 2024
1 parent 5da83d8 commit 094d404
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions Cython/Compiler/ExprNodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -14704,6 +14704,12 @@ def calculate_result_code(self):
def generate_result_code(self, code):
pass

def generate_bool_evaluation_code(self, *args, **kwds):
# This is enough of a corner-case that it probably isn't worth
# the corner-case of supporting it right now.
error(self.pos, "Using C++ classes in boolean binary operators with "
"the 'cpp_locals' directive is not currently supported.")

def _make_move_result_rhs(self, result, optional=False):
# this wouldn't normally get moved (because it isn't a temp), but force it to be because it
# is a thin wrapper around a temp
Expand Down
2 changes: 1 addition & 1 deletion tests/run/cpp_operators.pyx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# mode: run
# tag: cpp, werror
# tag: cpp, werror, no-cpp-locals

from __future__ import division

Expand Down

0 comments on commit 094d404

Please sign in to comment.