Skip to content

Commit ff1d017

Browse files
committed
Add encoding to constructor
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
1 parent 9647c26 commit ff1d017

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

bpython/curtsiesfrontend/interpreter.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def format(self, tokensource, outfile):
6464

6565

6666
class Interp(ReplInterpreter):
67-
def __init__(self, locals=None):
67+
def __init__(self, locals=None, encoding=None):
6868
"""Constructor.
6969
7070
The optional 'locals' argument specifies the dictionary in
@@ -77,7 +77,9 @@ def __init__(self, locals=None):
7777
"""
7878
if locals is None:
7979
locals = {"__name__": "__console__", "__doc__": None}
80-
ReplInterpreter.__init__(self, locals, getpreferredencoding())
80+
if encoding is None:
81+
encoding = getpreferredencoding()
82+
ReplInterpreter.__init__(self, locals, encoding)
8183

8284
self.locals = locals
8385
self.compile = CommandCompiler()

0 commit comments

Comments
 (0)