Skip to content

Commit

Permalink
Python 3.13 fixes (#11185)
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Williamson <awilliam@redhat.com>
  • Loading branch information
AdamWill committed Jun 18, 2024
1 parent f6e0690 commit 1755a71
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
21 changes: 11 additions & 10 deletions dask/delayed.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,16 +141,17 @@ def unpack_collections(expr):
if hasattr(expr, f.name)
}
replace(expr, **_fields)
except TypeError as e:
raise TypeError(
f"Failed to unpack {typ} instance. "
"Note that using a custom __init__ is not supported."
) from e
except ValueError as e:
raise ValueError(
f"Failed to unpack {typ} instance. "
"Note that using fields with `init=False` are not supported."
) from e
except (TypeError, ValueError) as e:
if isinstance(e, ValueError) or "is declared with init=False" in str(e):
raise ValueError(
f"Failed to unpack {typ} instance. "
"Note that using fields with `init=False` are not supported."
) from e
else:
raise TypeError(
f"Failed to unpack {typ} instance. "
"Note that using a custom __init__ is not supported."
) from e
return (apply, typ, (), (dict, args)), collections

if is_namedtuple_instance(expr):
Expand Down
2 changes: 1 addition & 1 deletion dask/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ def f(a, c):
assert "not supported" in b_arg.lower()
assert "dask" in b_arg.lower()

assert " extra docstring\n\n" in Zap.f.__doc__
assert "extra docstring\n\n" in Zap.f.__doc__


@pytest.mark.parametrize(
Expand Down

0 comments on commit 1755a71

Please sign in to comment.