Skip to content

Commit b40ce7d

Browse files
committed
stop str-ing in Interp.write, send FmtStr to stderr instead
1 parent b5dac4d commit b40ce7d

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
@@ -36,7 +36,7 @@ class BPythonFormatter(Formatter):
3636
Pygments highlight() method and slops
3737
them into the appropriate format string
3838
as defined above, then writes to the outfile
39-
object the final formatted string.
39+
object the final formatted string. This does not write real strings. It writes format string (FmtStr) objects.
4040
4141
See the Pygments source for more info; it's pretty
4242
straightforward."""
@@ -54,7 +54,7 @@ def format(self, tokensource, outfile):
5454
while token not in self.f_strings:
5555
token = token.parent
5656
o += "%s\x03%s\x04" % (self.f_strings[token], text)
57-
outfile.write(str(parse(o.rstrip())))
57+
outfile.write(parse(o.rstrip()))
5858

5959
class Interp(code.InteractiveInterpreter):
6060
def __init__(self, locals=None):
@@ -146,6 +146,8 @@ def showtraceback(self):
146146
l[len(l):] = traceback.format_exception_only(type, value)
147147
tbtext = ''.join(l)
148148
lexer = get_lexer_by_name("pytb", stripall=True)
149+
150+
149151
traceback_informative_formatter = BPythonFormatter(default_colors)
150152
traceback_code_formatter = BPythonFormatter({Token: ('d')})
151153
tokens= list(lexer.get_tokens(tbtext))

0 commit comments

Comments
 (0)