Alwaysgaurav1 opened a new pull request, #69438:
URL: https://github.com/apache/airflow/pull/69438

   ### Description
   
   When using `PythonVirtualenvOperator` with `pendulum<3` in the virtual 
environment while the host runs Pendulum v3, pickling/unpickling fails because 
Pendulum's internal representations are incompatible across major versions.
   
   The existing `_pendulum_to_native_datetime` function only converts 
`pendulum.DateTime` objects to native `datetime.datetime`. However, other 
Pendulum types (`Date`, `Time`, `Duration`, `Timezone`) can also leak into 
serialized arguments and return values, causing `AttributeError` exceptions 
like `type object 'Timezone' has no attribute '_unpickle'`.
   
   This PR extends both the host-side and guest-side conversion functions to 
handle all Pendulum types:
   - `pendulum.Date` → `datetime.date`
   - `pendulum.Time` → `datetime.time`
   - `pendulum.Duration` → `datetime.timedelta`
   - `pendulum.tz.timezone.PendulumTimezone` → `zoneinfo.ZoneInfo` or 
`datetime.timezone`
   
   The guest-side `_native_datetime_to_pendulum` function in the Jinja2 
template is also updated to convert the native types back to their Pendulum 
equivalents.
   
   A new unit test `test_pendulum_to_native_datetime_extended` verifies all the 
new type conversions.
   
   Closes: #50752


-- 
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]

Reply via email to