Commit bbad452
fix(serde): resolve generic-dataclass type parameters on Python 3.12
Decoding a PEP 695 generic dataclass (e.g. `Box[int]`, declared `class Box[T]`)
raised `CodecError: name 'T' is not defined` on Python 3.12. The field
annotations reference the class type parameters, and 3.12's `get_type_hints`
does not place those parameters in scope (3.13+ resolves them automatically).
Pass the class `__type_params__` through `get_type_hints`'s `localns` so the
annotations resolve on every supported interpreter. Verified against the full
suite on 3.12, 3.13, and 3.14.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent 865d217 commit bbad452
1 file changed
Lines changed: 7 additions & 1 deletion
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
900 | 900 | | |
901 | 901 | | |
902 | 902 | | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
903 | 909 | | |
904 | | - | |
| 910 | + | |
905 | 911 | | |
906 | 912 | | |
907 | 913 | | |
| |||
0 commit comments