Skip to content

Commit 2888354

Browse files
Jisu RyuCarreau
authored andcommitted
Fix line stripping logic
1 parent d7d58a3 commit 2888354

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

IPython/core/magics/code.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,8 @@ def strip_initial_indent(lines):
154154
for line in it:
155155
if line.startswith(indent):
156156
yield line[len(indent):]
157+
elif line in ('\n', '\r\n') or len(line) == 0:
158+
yield line
157159
else:
158160
# Less indented than the first line - stop dedenting
159161
yield line

0 commit comments

Comments
 (0)