Commit ac79078
fix: handle types.UnionType in from_dict_deep, fix missed List reference
On Python 3.10-3.12, the `X | Y` syntax creates a `types.UnionType`
which is distinct from `typing.Union`. The `from_dict_deep` method
in `SerializableDataClass` only checked for `typing.Union` via
`get_origin`, so it failed to deserialize union-typed fields when
the annotation used pipe syntax (e.g. `PromptBlockData`).
Also fixes a missed `cast(List, ...)` → `cast(list, ...)` in
langchain test_callbacks.py that caused a pylint E0602.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent 010af87 commit ac79078
2 files changed
Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
399 | 399 | | |
400 | 400 | | |
401 | 401 | | |
402 | | - | |
| 402 | + | |
403 | 403 | | |
404 | 404 | | |
405 | 405 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
42 | | - | |
| 43 | + | |
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
| |||
0 commit comments