Skip to content

Commit b71f411

Browse files
committed
fix: Reload and Auto-reloading doesn't work when using Python3.x
1 parent ff4ad26 commit b71f411

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

bpython/curtsiesfrontend/repl.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ def smarter_request_reload(files_modified=()):
450450

451451
self.incremental_search_target = ''
452452

453-
self.original_modules = sys.modules.keys()
453+
self.original_modules = set(sys.modules.keys())
454454

455455
self.width = None
456456
self.height = None
@@ -846,9 +846,8 @@ def clear_modules_and_reevaluate(self):
846846
if self.watcher:
847847
self.watcher.reset()
848848
cursor, line = self.cursor_offset, self.current_line
849-
for modname in sys.modules.keys():
850-
if modname not in self.original_modules:
851-
del sys.modules[modname]
849+
for modname in (set(sys.modules.keys()) - self.original_modules):
850+
del sys.modules[modname]
852851
self.reevaluate(insert_into_history=True)
853852
self.cursor_offset, self.current_line = cursor, line
854853
self.status_bar.message(_('Reloaded at %s by user.') %

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy