Ignore symlinks when recompiling for :restart

Otherwise broken symlinks (*cough* emacs *cough*) cause this to fail
with FileNotFoundError.
This commit is contained in:
Florian Bruhin 2016-06-08 12:56:37 +02:00
parent a5a4c17b1f
commit 9beb68bb5c

View File

@ -497,7 +497,7 @@ class Quitter:
for dirpath, _dirnames, filenames in os.walk(path):
for fn in filenames:
if os.path.splitext(fn)[1] == '.py':
if os.path.splitext(fn)[1] == '.py' and os.path.isfile(fn):
with tokenize.open(os.path.join(dirpath, fn)) as f:
compile(f.read(), fn, 'exec')