Skip to content

Commit d022657

Browse files
authored
Fix line stripping edge case for %load magic command (ipython#14495)
Closes: ipython#14494
2 parents 25703b5 + 298e9f5 commit d022657

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

IPython/core/magics/code.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,9 @@ def strip_initial_indent(lines):
153153

154154
for line in it:
155155
if line.startswith(indent):
156-
yield line[len(indent):]
156+
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)