From 75d9b1fe1786a5a02de7d20209d2561104f51612 Mon Sep 17 00:00:00 2001 From: Valentin Stanciu <250871+svalentin@users.noreply.github> Date: Wed, 10 May 2023 15:22:10 -0700 Subject: [PATCH 1/2] Mark ErrorCodes as serializable When starting mypy daemon, we pickle options. Error codes are part of options and need to be pickle-able. This decorator is needed for this to be possible with mypyc. --- mypy/errorcodes.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mypy/errorcodes.py b/mypy/errorcodes.py index 6b63bad72683..fb3eb1aa3e23 100644 --- a/mypy/errorcodes.py +++ b/mypy/errorcodes.py @@ -6,12 +6,14 @@ from __future__ import annotations from collections import defaultdict +from mypy_extensions import mypyc_attr from typing_extensions import Final error_codes: dict[str, ErrorCode] = {} sub_code_map: dict[str, set[str]] = defaultdict(set) +@mypyc_attr(serializable=True) class ErrorCode: def __init__( self, From ecb3ca3419d79b8e681c9fa107e1b691654cc7ba Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 10 May 2023 22:24:20 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- mypy/errorcodes.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mypy/errorcodes.py b/mypy/errorcodes.py index fb3eb1aa3e23..fe460fdec744 100644 --- a/mypy/errorcodes.py +++ b/mypy/errorcodes.py @@ -6,9 +6,10 @@ from __future__ import annotations from collections import defaultdict -from mypy_extensions import mypyc_attr from typing_extensions import Final +from mypy_extensions import mypyc_attr + error_codes: dict[str, ErrorCode] = {} sub_code_map: dict[str, set[str]] = defaultdict(set)