mirror of
https://github.com/m-labs/artiq.git
synced 2024-12-26 03:38:25 +08:00
import_cache: make sure last line ends with \n as linecache does. Closes #547
This commit is contained in:
parent
dbc08bde8a
commit
c414026b29
@ -29,7 +29,10 @@ def hook_exec_module(self, module):
|
|||||||
fn = module.__file__
|
fn = module.__file__
|
||||||
try:
|
try:
|
||||||
with tokenize.open(fn) as fp:
|
with tokenize.open(fn) as fp:
|
||||||
cache[fn] = fp.readlines()
|
lines = fp.readlines()
|
||||||
|
if lines and not lines[-1].endswith("\n"):
|
||||||
|
lines[-1] += "\n"
|
||||||
|
cache[fn] = lines
|
||||||
except:
|
except:
|
||||||
logger.warning("failed to add '%s' to cache", fn, exc_info=True)
|
logger.warning("failed to add '%s' to cache", fn, exc_info=True)
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user