summaryrefslogtreecommitdiffstats
path: root/Lib/functools.py
diff options
context:
space:
mode:
authorLysandros Nikolaou <lisandrosnik@gmail.com>2019-05-19 22:11:21 (GMT)
committerƁukasz Langa <lukasz@langa.pl>2019-05-19 22:11:20 (GMT)
commitd673810b9d9df6fbd29f5b7db3973d5adae10fd3 (patch)
tree0728ce5ebbc148751ee1e11dcfff333004bd246b /Lib/functools.py
parent287b84de939db47aa8c6f30734ceb8aba9d1db29 (diff)
downloadcpython-d673810b9d9df6fbd29f5b7db3973d5adae10fd3.zip
cpython-d673810b9d9df6fbd29f5b7db3973d5adae10fd3.tar.gz
cpython-d673810b9d9df6fbd29f5b7db3973d5adae10fd3.tar.bz2
bpo-35252: Remove FIXME from test_functools (GH-10551)
Diffstat (limited to 'Lib/functools.py')
-rw-r--r--Lib/functools.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/Lib/functools.py b/Lib/functools.py
index 28d9f6f..c863341 100644
--- a/Lib/functools.py
+++ b/Lib/functools.py
@@ -861,9 +861,11 @@ def singledispatch(func):
# only import typing if annotation parsing is necessary
from typing import get_type_hints
argname, cls = next(iter(get_type_hints(func).items()))
- assert isinstance(cls, type), (
- f"Invalid annotation for {argname!r}. {cls!r} is not a class."
- )
+ if not isinstance(cls, type):
+ raise TypeError(
+ f"Invalid annotation for {argname!r}. "
+ f"{cls!r} is not a class."
+ )
registry[cls] = func
if cache_token is None and hasattr(cls, '__abstractmethods__'):
cache_token = get_cache_token()