From 1fab96bf829c2ff6f1a10e3a47718f77a4a4a5ad Mon Sep 17 00:00:00 2001 From: Nikita Sobolev Date: Sat, 24 Jun 2023 07:56:46 +0300 Subject: [PATCH] Remove special handling of `kw_only` in `dataclass` plugin serialization (#15502) It is not needed, because it is always serialized as `bool` and is always present. It was added a long time ago in https://github.com/python/mypy/pull/10867 as a compat layer. But, since then we've added at least one `is_neither_frozen_nor_nonfrozen` attribute that is serialized / deserialized in a common way. So, let's remove this hack for good. --- mypy/plugins/dataclasses.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/mypy/plugins/dataclasses.py b/mypy/plugins/dataclasses.py index 913b1ef23312..cf58e577056c 100644 --- a/mypy/plugins/dataclasses.py +++ b/mypy/plugins/dataclasses.py @@ -158,8 +158,6 @@ def deserialize( cls, info: TypeInfo, data: JsonDict, api: SemanticAnalyzerPluginInterface ) -> DataclassAttribute: data = data.copy() - if data.get("kw_only") is None: - data["kw_only"] = False typ = deserialize_and_fixup_type(data.pop("type"), api) return cls(type=typ, info=info, **data)