Support dictionary unpacking in dict literals ({**x, 'key': val})
## Description
Dictionary unpacking inside dict literals (PEP 448) is not yet supported by Monty's syntax parser. Attempting to use `{**expr, ...}` raises a `MontyRuntimeError` at parse time (before `.run()` is called).
## Reproduction
```python
import pydantic_monty
code = """
def process(result):
return {**result, 'value': 'modified'}
"""
monty = pydantic_monty.Monty(code, inputs=["__arg0"], type_check=False)
# Raises: MontyRuntimeError: NotImplementedError: The monty syntax parser does not yet support dictionary unpacking in literals
```
## Error
```
pydantic_monty.MontyRuntimeError: NotImplementedError: The monty syntax parser does not yet support dictionary unpacking in literals
```
Note: the error is thrown at `Monty(...)` construction time, not at `.run()` — so it is a parse/AST-walk failure, not a runtime one.
## Expected behaviour
`{**result, 'value': 'modified'}` should execute and return a merged dict, equivalent to:
```python
{**result, 'value': 'modified'} # => {'score': 0.8, 'value': 'modified', 'confidence': 0.9}
```
## Workaround
Use explicit key construction instead:
```python
{'score': result.get('score'), 'value': 'modified', 'confidence': result.get('confidence')}
```
## Environment
- `pydantic-monty` version: 0.0.7
- Python: 3.13
- Platform: macOS (darwin)
## Notes
The error message already says "does not **yet** support", so this appears to be a known gap on the roadmap. Logging this to make it trackable.
0 条评论