From bf50612d767ef4e83466b39716591a1158b751e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Wed, 24 Jul 2019 23:05:02 +0300 Subject: [PATCH] inspect: get{doc,comments,module,sourcefile} can return None (#3137) --- stdlib/2/inspect.pyi | 8 ++++---- stdlib/3/inspect.pyi | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/stdlib/2/inspect.pyi b/stdlib/2/inspect.pyi index 8bc2eacb1..654fa0773 100644 --- a/stdlib/2/inspect.pyi +++ b/stdlib/2/inspect.pyi @@ -55,11 +55,11 @@ def ismemberdescriptor(object: object) -> bool: ... def findsource(object: object) -> Tuple[List[str], int]: ... def getabsfile(object: object) -> str: ... def getblock(lines: Sequence[str]) -> Sequence[str]: ... -def getdoc(object: object) -> str: ... -def getcomments(object: object) -> str: ... +def getdoc(object: object) -> Optional[str]: ... +def getcomments(object: object) -> Optional[str]: ... def getfile(object: object) -> str: ... -def getmodule(object: object) -> ModuleType: ... -def getsourcefile(object: object) -> str: ... +def getmodule(object: object) -> Optional[ModuleType]: ... +def getsourcefile(object: object) -> Optional[str]: ... # TODO restrict to "module, class, method, function, traceback, frame, # or code object" def getsourcelines(object: object) -> Tuple[List[str], int]: ... diff --git a/stdlib/3/inspect.pyi b/stdlib/3/inspect.pyi index 61737158e..320200c44 100644 --- a/stdlib/3/inspect.pyi +++ b/stdlib/3/inspect.pyi @@ -80,11 +80,11 @@ def ismemberdescriptor(object: object) -> bool: ... def findsource(object: object) -> Tuple[List[str], int]: ... def getabsfile(object: object) -> str: ... def getblock(lines: Sequence[str]) -> Sequence[str]: ... -def getdoc(object: object) -> str: ... -def getcomments(object: object) -> str: ... +def getdoc(object: object) -> Optional[str]: ... +def getcomments(object: object) -> Optional[str]: ... def getfile(object: object) -> str: ... -def getmodule(object: object) -> ModuleType: ... -def getsourcefile(object: object) -> str: ... +def getmodule(object: object) -> Optional[ModuleType]: ... +def getsourcefile(object: object) -> Optional[str]: ... # TODO restrict to "module, class, method, function, traceback, frame, # or code object" def getsourcelines(object: object) -> Tuple[List[str], int]: ...