tirkarthi commented on issue #29414:
URL: https://github.com/apache/airflow/issues/29414#issuecomment-1425638406

   I guess this should be resolved by 
https://github.com/apache/airflow/commit/aefa482051ec249f42095286a0fe4cf0eec1f6f4
 in Airflow 2.6 . Simplified reproducer.
   
   Before the above commit : 
   
   ```
   >>> from airflow.utils import json as js
   >>> import json, datetime
   >>> json.dumps({"a": datetime.date.today()}, cls=js.XComEncoder)
   Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
     File "/usr/lib/python3.10/json/__init__.py", line 238, in dumps
       **kw).encode(obj)
     File "/home/karthikeyan/stuff/python/airflow/airflow/utils/json.py", line 
176, in encode
       return super().encode(o)
     File "/usr/lib/python3.10/json/encoder.py", line 199, in encode
       chunks = self.iterencode(o, _one_shot=True)
     File "/usr/lib/python3.10/json/encoder.py", line 257, in iterencode
       return _iterencode(o, 0)
     File "/home/karthikeyan/stuff/python/airflow/airflow/utils/json.py", line 
153, in default
       CLASSNAME: o.__module__ + "." + o.__class__.__qualname__,
   AttributeError: 'datetime.date' object has no attribute '__module__'
   ```
   
   Main branch : 
   
   ```
   >>> from airflow.utils import json as js
   >>> import json, datetime
   >>> json.dumps({"a": datetime.date.today()}, cls=js.XComEncoder)
   '{"a": {"__classname__": "datetime.date", "__version__": 1, "__data__": 
"2023-02-10"}}'
   ```


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