uranusjr commented on code in PR #61671:
URL: https://github.com/apache/airflow/pull/61671#discussion_r2785926513
##########
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:
Shallow copy is sufficient here.
```suggestion
copy_var = {**var, "weekday":
dateutil.relativedelta.weekday(*copy_var["weekday"])}
return dateutil.relativedelta.relativedelta(**copy_var)
```
--
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]