-
-
Notifications
You must be signed in to change notification settings - Fork 137
Description
It looks like typing_extension versions <4.2 were contained a small bug related to PEP 681: Within the dataclass_transform decorator, the kwarg field_specifiers was erroneously called field_descriptors. This has recently been fixed for versions 4.2+.
The issue is that versions 4.2+ were not released for Python 3.6. This means that under Python 3.6 the code still looks like this:
if hasattr(typing, 'dataclass_transform'):
dataclass_transform = typing.dataclass_transform
else:
def dataclass_transform(
*,
eq_default: bool = True,
order_default: bool = False,
kw_only_default: bool = False,
field_descriptors: typing.Tuple[
typing.Union[typing.Type[typing.Any], typing.Callable[..., typing.Any]],
...
] = (),
) -> typing.Callable[[T], T]:
...This means that it is impossible to use dataclass_transform consistently for across Python 3.6 and later versions (code using the proper keyword field_descriptors crashes at runtime under Python 3.6). Furthermore PEP 681 requires these keywords to be specified statically, so generating the kwargs dynamically doesn't seem to work either.
Would it be possible to backport this fix and release an update of typing_extensions for Python 3.6?