Three-argument filtered map macro raises ValueError during evaluation
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 68/100
Research direction
Start by running the provided repro.py against the map macro evaluator and trace the three-argument filtered map path described in the issue. Add coverage for both expressions, then confirm the filtered form returns 3 instead of raising ValueError while the existing filter(...).map(...) form still passes.
Written by the indexing model from the issue text.
Description
Summary
The standard filtered map(x, predicate, transform) form compiles but raises ValueError: too many values to unpack (expected 2) during evaluation. The equivalent filter(...).map(...) expression completes normally.
Reproduction
Save the following as repro.py.
from celpy import Environment
for expression in (
"[1,2,3].map(x, x > 1, x+1)[0]",
"[1,2,3].filter(x, x > 1).map(x, x+1)[0]",
):
env = Environment()
try:
result = env.program(env.compile(expression)).evaluate({})
print(expression, "=>", result)
except Exception as exc:
print(expression, "=>", type(exc).__name__, str(exc))
Run:
python -m pip install cel-python==0.5.0
python repro.py
Actual result
[1,2,3].map(x, x > 1, x+1)[0] => ValueError too many values to unpack (expected 2)
[1,2,3].filter(x, x > 1).map(x, x+1)[0] => 3
Expected behavior and why
Both expressions should return 3: filter [1,2,3] to [2,3], add one to each element, and select the first result.
CEL defines e.map(x, p, t) as the map transformation with predicate filtering before transformation:
https://github.com/cel-expr/cel-spec/blob/ba58ae5007845f3a1279b488cdeb79645ce958bb/doc/langdef.md#macros
Code-level observation and impact
The map evaluator unpacks two macro arguments where this form supplies three. This is an internal Python arity error rather than the normal evaluation of a supported CEL expression. If this macro overload is intentionally outside the supported profile, please clarify that scope; accepting the syntax and then raising an unpacking error is still an unhelpful failure mode for callers.
Environment
- Package: cel-python 0.5.0
- Runtime: CPython 3.13.3
- OS: macOS 26.6.2, Apple Silicon / arm64
- Reproduced: 2026-09-11
- Dominant language
- Python
- Stars
- 174
- Forks
- 40
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from cloud-custodian/cel-python
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
cloud-custodian/cel-python#180 · 1 comment ·
-
documentation enhancement tracking
Difficulty 3/5 1-2 days Newbie friendliness 68/100
cloud-custodian/cel-python#182 ·
-
Refresh Features Opendependencies
cloud-custodian/cel-python#172 · 2 comments · 1 assignee ·
-
enhancement
cloud-custodian/cel-python#169 · 3 comments · 1 assignee ·
-
bug
cloud-custodian/cel-python#145 · 4 comments · 2 assignees ·
All issues in cloud-custodian/cel-python
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100