X Tutup
Skip to content

Commit 9cdf92d

Browse files
committed
Change __name__ to "__main__".
1 parent 200ad6a commit 9cdf92d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

bpython/cli.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ def next_token_inside_string(s, inside_string):
248248

249249
class Interpreter(code.InteractiveInterpreter):
250250

251-
def __init__(self, encoding):
251+
def __init__(self, locals=None, encoding=sys.getdefaultencoding()):
252252
"""The syntaxerror callback can be set at any time and will be called
253253
on a caught syntax error. The purpose for this in bpython is so that
254254
the repl can be instantiated after the interpreter (which it
@@ -260,7 +260,7 @@ def __init__(self, encoding):
260260
self.encoding = encoding
261261
self.syntaxerror_callback = None
262262
# Unfortunately code.InteractiveInterpreter is a classic class, so no super()
263-
code.InteractiveInterpreter.__init__(self)
263+
code.InteractiveInterpreter.__init__(self, locals)
264264

265265
def runsource(self, source):
266266
source = '# coding: %s\n%s' % (self.encoding,
@@ -2122,7 +2122,8 @@ def main_curses(scr, args, interactive=True):
21222122

21232123
curses.raw(True)
21242124

2125-
interpreter = Interpreter(getpreferredencoding())
2125+
interpreter = Interpreter(dict(__name__='__main__', __doc__=None),
2126+
getpreferredencoding())
21262127

21272128
repl = Repl(main_win, interpreter, statusbar, idle)
21282129
interpreter.syntaxerror_callback = repl.clear_current_line

0 commit comments

Comments
 (0)
X Tutup