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

ephraimanierobi pushed a commit to branch v3-1-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit 11a27590ea2c5738be0a42d4f3f32ef0d76f5bfc
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Wed Dec 10 12:48:20 2025 +0000

    [v3-1-test] Fix an odd import of pendulum from sqlalchemy_utils instead of 
elsewhere. (#59258) (#59265)
    
    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 :)
    (cherry picked from commit 0b6d2589df046535b284e032ea8fa5922fab3b6f)
    
    Co-authored-by: Ash Berlin-Taylor <[email protected]>
---
 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