If you want the attached branch to be reviewed, please submit a merge proposal.
Taking a quick look at the diff, I have a few comments:
1. you probably only want to do this sort of check if is_expr1 is True.
2. it would be better to check that both expressions have the same variable factory (i.e. getattr(info1, "variable_factory", Variable) is the same as getattr(info2, "variable_factory", Variable)).
If you want the attached branch to be reviewed, please submit a merge proposal.
Taking a quick look at the diff, I have a few comments:
1. you probably only want to do this sort of check if is_expr1 is True.
2. it would be better to check that both expressions have the same variable factory (i.e. getattr(info1, "variable_factory", Variable) is the same as getattr(info2, "variable_factory", Variable)).
Special casing SQL and FuncExpr seems wrong.