Skip to content

Commit 10ee932

Browse files
Fixed a small bug in the repl (undefined variable).
1 parent f6c85ef commit 10ee932

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

prompt_toolkit/contrib/repl.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,9 @@ def _execute(self, line):
116116
locals = self.get_locals()
117117
locals['_'] = locals['_%i' % settings.current_statement_index] = result
118118

119-
out_mark = 'Out[%i]: ' % settings.current_statement_index
120-
121119
if result is not None:
120+
out_mark = 'Out[%i]: ' % settings.current_statement_index
121+
122122
try:
123123
result_str = '%r\n' % (result, )
124124
except UnicodeDecodeError:
@@ -128,11 +128,11 @@ def _execute(self, line):
128128
# characters. Decode as utf-8 in that case.
129129
result_str = '%s\n' % repr(result).decode('utf-8')
130130

131-
# align every line to the first one
132-
line_sep = '\n' + ' ' * len(out_mark)
133-
out_string = out_mark + line_sep.join(result_str.splitlines())
131+
# align every line to the first one
132+
line_sep = '\n' + ' ' * len(out_mark)
133+
out_string = out_mark + line_sep.join(result_str.splitlines())
134134

135-
self.cli.stdout.write(out_string)
135+
self.cli.stdout.write(out_string)
136136
# If not a valid `eval` expression, run using `exec` instead.
137137
except SyntaxError:
138138
exec_(line, self.get_globals(), self.get_locals())

0 commit comments

Comments
 (0)