From 050a009f1e945e6b19b31b313c5743cb5a762e6d Mon Sep 17 00:00:00 2001 From: Jonathan Slenders Date: Tue, 16 Feb 2021 18:23:13 +0100 Subject: [PATCH] Handle empty annotation in parameter. --- ptpython/signatures.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ptpython/signatures.py b/ptpython/signatures.py index 228b99b2..8256f707 100644 --- a/ptpython/signatures.py +++ b/ptpython/signatures.py @@ -84,10 +84,13 @@ def from_inspect_signature( ) -> "Signature": parameters = [] - def get_annotation_name(annotation: object) -> str: + def get_annotation_name(annotation: object) -> None: """ Get annotation as string from inspect signature. """ + if annotation == inspect.Parameter.empty: + return None + try: # In case the annotation is a class like "int", "float", ... return str(annotation.__name__) # type: ignore