Skip to content

BaseSerialization adds an extra tuple layer to built-in exception args #69743

Description

@nailo2c

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:

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?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions