We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
typing
annotationlib
1 parent 6bd9689 commit b3e3cc0Copy full SHA for b3e3cc0
1 file changed
Lib/annotationlib.py
@@ -27,7 +27,6 @@ class Format(enum.IntEnum):
27
STRING = 4
28
29
30
-_Union = None
31
_sentinel = object()
32
33
# Slots shared by ForwardRef and _Stringifier. The __forward__ names must be
@@ -246,16 +245,10 @@ def __hash__(self):
246
245
return hash((self.__forward_arg__, self.__forward_module__))
247
248
def __or__(self, other):
249
- global _Union
250
- if _Union is None:
251
- from typing import Union as _Union
252
- return _Union[self, other]
+ return types.UnionType[self, other]
253
254
def __ror__(self, other):
255
256
257
258
- return _Union[other, self]
+ return types.UnionType[other, self]
259
260
def __repr__(self):
261
if self.__forward_module__ is None:
0 commit comments