This is an automated email from the ASF dual-hosted git repository.

ashb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 5eba7439d76 Make cron timetables hashable (#73859)
5eba7439d76 is described below

commit 5eba7439d76b71a642a2955a483236f474b2e880
Author: Adam Postek <[email protected]>
AuthorDate: Tue Sep 29 14:17:08 2026 +0000

    Make cron timetables hashable (#73859)
---
 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 ed0b3c76bb7..245cc3fbc39 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 f4718f8d04b..02a58323e14 100644
--- a/airflow-core/tests/unit/timetables/test_trigger_timetable.py
+++ b/airflow-core/tests/unit/timetables/test_trigger_timetable.py
@@ -1196,3 +1196,10 @@ def 
test_run_immediately_does_not_pick_future_run(get_info: typing.Callable[[],
     assert info is not None
     assert info.run_after <= pendulum.DateTime(2024, 11, 3, 5, 30, tzinfo=utc)
     assert info.run_after == pendulum.DateTime(2024, 11, 2, 5, tzinfo=utc)
+
+
+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)

Reply via email to