nagasrisai opened a new pull request, #64570:
URL: https://github.com/apache/airflow/pull/64570
### Description
`xcom_pull()` accepts a `default` parameter documented as the value to
return when no matching XCom is found. However, when `map_indexes` is not
explicitly supplied (the `NOTSET` / "no-map-index" code path), the `get_all`
branch unconditionally appended `None` to the result list regardless of what
the caller passed as `default`.
**Root cause** — `task_runner.py`, inside the `if not
is_arg_set(map_indexes):` block:
```python
# before
if values is None:
xcoms.append(None) # user-supplied default is ignored
# after
if values is None:
xcoms.append(default) # respects the caller's default
```
The `map_indexes`-set path (lines below) already used
`xcoms.append(default)` correctly; this brings the no-map-index path into line
with that behaviour.
### Changes
* `task-sdk/src/airflow/sdk/execution_time/task_runner.py`: one-line fix,
`xcoms.append(None)` → `xcoms.append(default)`.
* `task-sdk/tests/task_sdk/execution_time/test_task_runner.py`: new test
`test_xcom_pull_default_respected_when_no_map_indexes` that confirms the
`default` value is returned when `get_all` yields `None`.
* `airflow-core/newsfragments/64295.bugfix.rst`: changelog fragment.
### Tests
```
pytest
task-sdk/tests/task_sdk/execution_time/test_task_runner.py::TestRuntimeTaskInstance::test_xcom_pull_default_respected_when_no_map_indexes
```
Closes #64295
--
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]