This is an automated email from the ASF dual-hosted git repository.
ashb pushed a commit to branch v3-3-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/v3-3-test by this push:
new 2bfe3c5ec25 Make cron timetables hashable (#73859) (#73908)
2bfe3c5ec25 is described below
commit 2bfe3c5ec255b451981c2f6a3a2f2e85771bcadc
Author: Adam Postek <[email protected]>
AuthorDate: Tue Sep 29 14:30:02 2026 +0000
Make cron timetables hashable (#73859) (#73908)
(cherry picked from commit 5eba7439d76b71a642a2955a483236f474b2e880)
---
airflow-core/src/airflow/timetables/_cron.py | 2 +-
airflow-core/tests/unit/timetables/test_trigger_timetable.py | 7 +++++++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/airflow-core/src/airflow/timetables/_cron.py
b/airflow-core/src/airflow/timetables/_cron.py
index db9950afb33..f45f9910a20 100644
--- a/airflow-core/src/airflow/timetables/_cron.py
+++ b/airflow-core/src/airflow/timetables/_cron.py
@@ -131,7 +131,7 @@ class CronMixin:
return self._expression == other._expression and self._timezone ==
other._timezone
def __hash__(self):
- return hash((self._expression, self._timezone))
+ return hash((self._expression, str(self._timezone)))
@property
def summary(self) -> str:
diff --git a/airflow-core/tests/unit/timetables/test_trigger_timetable.py
b/airflow-core/tests/unit/timetables/test_trigger_timetable.py
index eef68b0679f..a23cb056d07 100644
--- a/airflow-core/tests/unit/timetables/test_trigger_timetable.py
+++ b/airflow-core/tests/unit/timetables/test_trigger_timetable.py
@@ -1149,3 +1149,10 @@ def
test_iter_partition_dagrun_infos_dst_america_new_york_spring_forward() -> No
# run_after == partition_date for both ticks.
for info in infos:
assert info.run_after == info.partition_date
+
+
+def test_cron_timetables_are_hashable():
+ timetable = CronTriggerTimetable("0 0 * * *", timezone="UTC")
+ same = CronTriggerTimetable("0 0 * * *", timezone="UTC")
+ assert timetable == same
+ assert hash(timetable) == hash(same)