Code/getfslineno: keep empty co_filename

Previously this would be turned via `py.path.local("")` into the current
working directory.

This appears to be what `fspath = fn and py.path.local(fn) or None`
tries to avoid in `getfslineno`'s `TypeError` handling already, if
`Code` would raise it.
This commit is contained in:
Daniel Hahler
2020-02-03 18:40:23 +01:00
parent b0d45267c5
commit 61f2a26675
2 changed files with 10 additions and 0 deletions

View File

@@ -72,6 +72,8 @@ class Code:
""" return a path object pointing to source code (or a str in case
of OSError / non-existing file).
"""
if not self.raw.co_filename:
return ""
try:
p = py.path.local(self.raw.co_filename)
# maybe don't try this checking