Challenging to diagnose bad expressions when using numerical comparison operators.
@klarose đang làm issue này rồi.
Từ ngày 27/9/2025.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
I have an expression where one side of a comparison operator fails (e.g. undeclared reference). The result is a "no matching overload" error, which isn't very helpful. I expect to see the original failure bubble up to the top of the evaluation.
E.g.
python3 -m celpy -n 'bad < 113.0'
ERROR: <input>:1:1 found no matching overload for 'relation_lt' applied to '(<class 'celpy.evaluation.CELEvalError'>, <class 'celpy.celtypes.DoubleType'>)'
| bad < 113.0
| ^
While the offending part of the expression is still in the output, it's still fairly misleading, and could cause code trying to customize error handling to do the wrong thing.
I took a quick gander where the failure occurs, and it seems to be that the builtin comparison operators don't have an overload for the CELEvalError class. Many of the others do. I'm not sure if this was a miss or on purpose.
Either way, hacking this in seemed to fix the problem:
diff --git a/src/celpy/evaluation.py b/src/celpy/evaluation.py
index 799b05c..8545a02 100644
--- a/src/celpy/evaluation.py
+++ b/src/celpy/evaluation.py
@@ -228,10 +228,22 @@ class CELEvalError(Exception):
def __rpow__(self, other: Any) -> "CELEvalError":
return self
+ def __lt__(self, other: Any) -> "CELEvalError":
+ raise self
+
+ def __le__(self, other: Any) -> "CELEvalError":
+ raise self
+
+ def __gt__(self, other: Any) -> "CELEvalError":
+ raise self
+
+ def __ge__(self, other: Any) -> "CELEvalError":
+ raise self
+
def __eq__(self, other: Any) -> bool:
if isinstance(other, CELEvalError):
return self.args == other.args
- return NotImplemented
+ raise self
def __call__(self, *args: Any) -> "CELEvalError":
return self
I can submit a PR if there's interest.
- Ngôn ngữ chính
- Python
- Star
- 173
- Fork
- 41
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của cloud-custodian/cel-python
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
cloud-custodian/cel-python#180 · 1 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
cloud-custodian/cel-python#194 ·
-
documentation enhancement tracking
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
cloud-custodian/cel-python#182 ·
-
Refresh FeaturesCó thể làm lại được @slott56 đã nhận 143 ngày trước và không có pull request nào đang mở. Đang mởdependencies
cloud-custodian/cel-python#172 · 2 bình luận · 1 người được giao ·
-
Permit multiple threads to share a common EnvironmentCó thể làm lại được @Quantum0uasar đã nhận 130 ngày trước và không có pull request nào đang mở. Đang mởenhancement
cloud-custodian/cel-python#169 · 3 bình luận · 1 người được giao ·
Tất cả issue của cloud-custodian/cel-python
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
EvaluationSuite.run fails with default args_for_task and mutates supplied kwargsCó thể đã có người làm @ktz03 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
huggingface/evaluate#825 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Add `django-upgrade` to the CIĐang mởdependencies feature github_actions good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
wemake-services/wemake-django-template#3149 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[request] vsg/1.1.16Đang mởupstream update
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
conan-io/conan-center-index#31142 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:core bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày