Merge pull request #6526 from blueyed/typing-code-path

doc: fix Code.path: might return str
This commit is contained in:
Daniel Hahler 2020-01-21 21:06:26 +01:00 committed by GitHub
commit 2f00b041e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -68,8 +68,9 @@ class Code:
@property
def path(self) -> Union[py.path.local, str]:
""" return a path object pointing to source code (note that it
might not point to an actually existing file). """
""" return a path object pointing to source code (or a str in case
of OSError / non-existing file).
"""
try:
p = py.path.local(self.raw.co_filename)
# maybe don't try this checking