cloud-custodian / cel-python

Pure Python implementation of the Common Expression Language
Apache License 2.0
99 stars 20 forks source link

Bug: comparing list to null throws error #59

Open shahargl opened 2 months ago

shahargl commented 2 months ago

Current behavior running CEL queue == null on {'queue': None} raises

CELEvalError(*("found no matching overload for 'relation_eq' applied to '(<class 'celpy.celtypes.ListType'>, <class 'NoneType'>)'", <class 'TypeError'>, ("no such overload: ListType == <class 'NoneType'>",)), tree='queue ==  null')

Although in the spect it should return true - https://playcel.undistro.io/?content=H4sIAAAAAAAAA3WRTWsCQQyG%2F0o6PdiC1bvgQYpQim2lpUhhL3E3rgMzmWU%2BtCL%2B92am20%2FwNGGSPO%2Bb5KgajKgm6hLuyBPoAHErD3cpQk5JCG%2BzhwU4D%2FcvT4%2Bwcd5iHFVc8bFSWNcucQyVmgAnY04Vq6Gi985TCNqxkMdjWJGpnSWIrtBv5wtYGjy0Xnqbi4ql5O9f9oEs2pE81lHvSBjrWQhk1%2BYAnduL2QaId9o7tsQxs0XWOBkCBSAxeV0yex23n7rOWscw%2F3YHC%2BQ2YUtwJfrXo%2BykuLmBldeR4OCSL9Z%2BJoKtSPdFr4EKGD0hSCrHQTeUl%2FRrh8MzS%2Bwpy0yGwXPiQZlihybhGXFsUXOI%2F47Ug%2Bb9%2FLmvdsaQbE563EYIaDtDoTcWOu0x5%2FIVv04I02k5oTp9AKJvo6kVAgAA

slott56 commented 1 month ago

Technically, None is raw Python. This isn't exactly the same thing has a CEL NullType instance.

We could raise a better exception for "raw" Python objects.

We could try to implicitly wrap raw Python objects in the most closely-associated CEL types.