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:
@@ -524,6 +524,14 @@ def test_getfslineno() -> None:
|
||||
B.__name__ = "B2"
|
||||
assert getfslineno(B)[1] == -1
|
||||
|
||||
co = compile("...", "", "eval")
|
||||
assert co.co_filename == ""
|
||||
|
||||
if hasattr(sys, "pypy_version_info"):
|
||||
assert getfslineno(co) == ("", -1)
|
||||
else:
|
||||
assert getfslineno(co) == ("", 0)
|
||||
|
||||
|
||||
def test_code_of_object_instance_with_call() -> None:
|
||||
class A:
|
||||
|
||||
Reference in New Issue
Block a user