Skip to content

Commit 14669c0

Browse files
committed
Set up __main__ module (fixes #959, #868)
1 parent af5e90a commit 14669c0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

bpython/args.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,10 +243,10 @@ def exec_code(
243243
raise SystemExit(e.errno)
244244
old_argv, sys.argv = sys.argv, args
245245
sys.path.insert(0, os.path.abspath(os.path.dirname(args[0])))
246-
spec = importlib.util.spec_from_loader("__console__", loader=None)
246+
spec = importlib.util.spec_from_loader("__main__", loader=None)
247247
assert spec
248248
mod = importlib.util.module_from_spec(spec)
249-
sys.modules["__console__"] = mod
249+
sys.modules["__main__"] = mod
250250
interpreter.locals.update(mod.__dict__) # type: ignore # TODO use a more specific type that has a .locals attribute
251251
interpreter.locals["__file__"] = args[0] # type: ignore # TODO use a more specific type that has a .locals attribute
252252
interpreter.runsource(source, args[0], "exec")

0 commit comments

Comments
 (0)