wjddn279 commented on code in PR #61671:
URL: https://github.com/apache/airflow/pull/61671#discussion_r2785423065
##########
airflow-core/src/airflow/serialization/decoders.py:
##########
@@ -56,9 +57,10 @@
def decode_relativedelta(var: dict[str, Any]) ->
dateutil.relativedelta.relativedelta:
"""Dencode a relativedelta object."""
- if "weekday" in var:
- var["weekday"] = dateutil.relativedelta.weekday(*var["weekday"])
- return dateutil.relativedelta.relativedelta(**var)
+ copy_var = deepcopy(var)
+ if "weekday" in copy_var:
+ copy_var["weekday"] =
dateutil.relativedelta.weekday(*copy_var["weekday"])
+ return dateutil.relativedelta.relativedelta(**copy_var)
Review Comment:
I attach the full log. This occurs when running `breeze start-airflow` on
the current main branch with the following DAG placed in the DAGs path.
[0925.txt](https://github.com/user-attachments/files/25198001/0925.txt)
[test_dag.py](https://github.com/user-attachments/files/25198008/test_dag.py)
I've confirmed that after the fix, it parses successfully with `breeze
start-airflow`. (Feel free to try it yourself.) As mentioned in the
description, serialization itself works correctly, but the value gets
unintentionally mutated during function execution. `{'weekday': [6]}` ->
`{'weekday': SU}`
To explain in more detail: the function is executed continuously every time
the [timetable
property](https://github.com/apache/airflow/blob/main/airflow-core/src/airflow/serialization/serialized_objects.py#L2270)
is called. On the first execution, {'weekday': [6]} is passed correctly, but
the value gets mutated to `{'weekday': SU}` during this first execution,
causing errors from the second execution onwards.
--
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]