Skip to content

Commit 8a260a8

Browse files
authored
fix(repr): remove expression printing from exception message (#10130)
1 parent 12a235c commit 8a260a8

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

ibis/backends/tests/test_interactive.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import pytest
1717

1818
import ibis
19+
import ibis.common.exceptions as exc
1920
from ibis import config
2021

2122

@@ -89,3 +90,18 @@ def test_isin_rule_suppressed_exception_repr_not_fail(table):
8990
expr = table.filter(bool_clause)["string_col"].value_counts()
9091

9192
repr(expr)
93+
94+
95+
def test_no_recursion_error(con, monkeypatch):
96+
monkeypatch.setattr(ibis.options, "interactive", True)
97+
monkeypatch.setattr(ibis.options, "default_backend", con)
98+
99+
a = ibis.memtable({"a": [1]})
100+
b = ibis.memtable({"b": [1]})
101+
102+
expr = a.count() + b.count()
103+
104+
with pytest.raises(
105+
exc.RelationError, match="The scalar expression cannot be converted"
106+
):
107+
repr(expr)

ibis/expr/types/generic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1366,7 +1366,7 @@ def as_table(self) -> ir.Table:
13661366
return parent.to_expr().aggregate(self)
13671367
else:
13681368
raise com.RelationError(
1369-
f"The scalar expression {self} cannot be converted to a "
1369+
"The scalar expression cannot be converted to a "
13701370
"table expression because it involves multiple base table "
13711371
"references"
13721372
)

0 commit comments

Comments
 (0)