FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-105499: Defer "import warnings" in typing by JelleZijlstra · Pull Request #132061 · python/cpython · GitHub

/ cpython Public
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
5 changes: 4 additions & 1 deletion Lib/typing.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import sys
import types
from types import GenericAlias
import warnings

from _typing import (
_idfunc,
Expand Down Expand Up @@ -1626,14 +1625,17 @@ def __getitem__(self, params):

class _UnionGenericAliasMeta(type):
def __instancecheck__(self, inst: object) -> bool:
import warnings
warnings._deprecated("_UnionGenericAlias", remove=(3, 17))
return isinstance(inst, Union)

def __subclasscheck__(self, inst: type) -> bool:
import warnings
warnings._deprecated("_UnionGenericAlias", remove=(3, 17))
return issubclass(inst, Union)

def __eq__(self, other):
import warnings
warnings._deprecated("_UnionGenericAlias", remove=(3, 17))
if other is _UnionGenericAlias or other is Union:
return True
Expand All @@ -1650,6 +1652,7 @@ class _UnionGenericAlias(metaclass=_UnionGenericAliasMeta):

"""
def __new__(cls, self_cls, parameters, /, *, name=None):
import warnings
warnings._deprecated("_UnionGenericAlias", remove=(3, 17))
return Union[parameters]

Expand Down

Back | FazBrowse Home | New Git URL