Skip to content

Commit bdd7c3c

Browse files
committed
Allow pickle serialization for schemas built from SDL
1 parent b3721c9 commit bdd7c3c

File tree

7 files changed

+610
-466
lines changed

7 files changed

+610
-466
lines changed

src/graphql/pyutils/undefined.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
1-
from typing import Any
1+
from typing import Any, Optional
22

33
__all__ = ["Undefined", "UndefinedType"]
44

55

66
class UndefinedType(ValueError):
77
"""Auxiliary class for creating the Undefined singleton."""
88

9+
_instance: Optional["UndefinedType"] = None
10+
11+
def __new__(cls) -> "UndefinedType":
12+
if cls._instance is None:
13+
cls._instance = super(UndefinedType, cls).__new__(cls)
14+
return cls._instance
15+
916
def __repr__(self) -> str:
1017
return "Undefined"
1118

0 commit comments

Comments
 (0)