Skip to content

Commit 60cf6a2

Browse files
committed
Verify if a module actually has a __file__ attribute so watchdog can watch it.
1 parent 87b0a9c commit 60cf6a2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

bpython/curtsies.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ def request_refresh():
8888
@wraps(orig_import)
8989
def new_import(name, globals={}, locals={}, fromlist=[], level=-1):
9090
m = orig_import(name, globals=globals, locals=locals, fromlist=fromlist)
91-
watcher.add_module(m.__file__)
91+
if hasattr(m, "__file__"):
92+
watcher.add_module(m.__file__)
9293
return m
9394
__builtins__['__import__'] = new_import
9495

0 commit comments

Comments
 (0)