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

ash 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 0b6d2589df0 Fix an odd import of pendulum from sqlalchemy_utils 
instead of elsewhere. (#59258)
0b6d2589df0 is described below

commit 0b6d2589df046535b284e032ea8fa5922fab3b6f
Author: Ash Berlin-Taylor <[email protected]>
AuthorDate: Wed Dec 10 09:43:17 2025 +0000

    Fix an odd import of pendulum from sqlalchemy_utils instead of elsewhere. 
(#59258)
    
    This was likely a case of auto-complete gone wrong. Most of the time this
    doesn't matter (as SQLa etc is already loaded) but this was importing it in
    Task SDK mistakenly which we don't want.
    
    
    Interestingly mypy now "noticed" that `pendulum.parse` can return
    Duration, Date, and Time objects too. I don't know why it didn't notice this
    before.
    
    Also generally this isn't the right import :)
---
 airflow-core/src/airflow/dag_processing/bundles/base.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/airflow-core/src/airflow/dag_processing/bundles/base.py 
b/airflow-core/src/airflow/dag_processing/bundles/base.py
index 1ab14abd047..2df62bcf2b8 100644
--- a/airflow-core/src/airflow/dag_processing/bundles/base.py
+++ b/airflow-core/src/airflow/dag_processing/bundles/base.py
@@ -32,8 +32,8 @@ from operator import attrgetter
 from pathlib import Path
 from typing import TYPE_CHECKING
 
+import pendulum
 from pendulum.parsing import ParserError
-from sqlalchemy_utils.types.enriched_datetime.pendulum_datetime import pendulum
 
 from airflow.configuration import conf
 
@@ -98,7 +98,8 @@ class BundleUsageTrackingManager:
 
     def _parse_dt(self, val) -> DateTime | None:
         try:
-            return pendulum.parse(val)
+            dt = pendulum.parse(val)
+            return dt if isinstance(dt, pendulum.DateTime) else None
         except ParserError:
             return None
 

Reply via email to