BaseSerialization adds an extra tuple layer to built-in exception args
- Dominant language
- Python
- Stars
- 46.9k
- Forks
- 17.8k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 472
Description
### Under which category would you file this issue?
Airflow Core
### Apache Airflow version
3.4.0
### What happened and how to reproduce it?
`BaseSerialization` does not preserve `args` when round-tripping a built-in exception such as `KeyError`.
Steps to reproduce:
```python
from airflow.serialization.serialized_objects import BaseSerialization
r = BaseSerialization.deserialize(BaseSerialization.serialize(KeyError("boom")))
assert r.args == ("boom",)
```
Actual result:
```
r.args
# (('boom',),)
```
Expected result:
```
r.args
# ("boom",)
```
### What you think should happen instead?
Deserializing a serialized KeyError("boom") should reconstruct the exception with the same args as the original exception. The current result wraps the original args tuple in another tuple.
### Operating System
Debian GNU/Linux
### Deployment
None
### Apache Airflow Provider(s)
_No response_
### Versions of Apache Airflow Providers
_No response_
### Official Helm Chart version
Not Applicable
### Kubernetes Version
_No response_
### Helm Chart configuration
_No response_
### Docker Image customizations
_No response_
### Anything else?
_No response_
### Are you willing to submit PR?
- [x] Yes I am willing to submit a PR!
### Code of Conduct
- [x] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
Contributor guide
Research direction
Start with BaseSerialization in airflow/serialization/serialized_objects.py and run the reproduction from the issue using KeyError("boom"). Trace the serialize/deserialize round trip and verify that the reconstructed exception's args exactly match ("boom",), without the extra tuple layer.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100