Eason09053360 opened a new pull request, #73400: URL: https://github.com/apache/airflow/pull/73400
## Why `LazyXComSequence.__getitem__` coerces index-like keys through `__index__`, but the `raise TypeError` sits outside the `if`, so it fires unconditionally and the coerced value is thrown away. Indexing a mapped task's results with a `numpy.int64` (what `argmax` returns) therefore always fails, while the slice path has accepted the same keys since `_coerce_slice_index` landed in the same commit (#50117). `key` is also overwritten before the message is built, so an integer-like key is reported as `...not int`. ## What - `lazy_sequence.py`: raise only when `__index__` is absent, and before `key` is reassigned. - `test_lazy_sequence.py`: `test_getitem_index_like` covers this branch, which had no coverage at all . That is why the dead coercion went unnoticed. `test_getitem_rejects_non_index` guards the reordered `raise`; it passes on `main` too. - `LazySelectSequence` in `airflow-core/src/airflow/utils/db.py` still rejects such keys, but is not on the Dag-authoring path. Happy to align it in a follow-up. --- ##### Was generative AI tooling used to co-author this PR? - [X] Yes — Claude Code (Opus 5) Generated-by: Claude Code (Opus 5) following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
