cloud-custodian / cloud-custodian/cel-python

type coercion inconsistently fails depending on order of arguments

Open
#114 2 comments 0 reactions 1 assignee Claimed by @klarose View on GitHub
bug
Dominant language
Python
Stars
174
Forks
40
PR merge metrics
No merged PRs in 30d

Description

I was surprised to find that a less-than comparison failed between an integer and a float, since I thought I had seen it work earlier. Sure enough, it works if the left hand side is a float, but not if the left hand side is an int.

Example:

```
# good
python -m celpy -n '4.0 < 10'
true

# bad
python -m celpy -n '10 < 4.0'
ERROR: :1:1 found no matching overload for 'relation_lt' applied to '(, )'
| 10 < 4.0

```

Both of these work in golang, see [cel playground](https://playcel.undistro.io/?trk=products_details_guest_secondary_call_to_action&content=H4sIAAAAAAAAA6tWSk7NUbJSiskzNFCwUTDRM1DSUUpJLEn0zCsoLQFKKCt4pBalKmQWK5RkACmQqAJIHshUiHT09VHIL1LwCvb3U0jLL8pNLNGLyYvJAxqRm5%2BSCtQNMrwWAPRTd6tkAAAA)

I expect both statements to properly evaluate. This appears to affect a bunch of other operators (<=, >, >=)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.