@@ -248,7 +248,7 @@ def next_token_inside_string(s, inside_string):
248248
249249class 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