From 2888354f992192106665b425e5ab34a3cef6d818 2024-10-25 08:30:32 From: Jisu Ryu Date: 2024-10-25 08:30:32 Subject: [PATCH] Fix line stripping logic --- diff --git a/IPython/core/magics/code.py b/IPython/core/magics/code.py index 4f1574d..4bfe3b1 100644 --- a/IPython/core/magics/code.py +++ b/IPython/core/magics/code.py @@ -154,6 +154,8 @@ def strip_initial_indent(lines): for line in it: if line.startswith(indent): yield line[len(indent):] + elif line in ('\n', '\r\n') or len(line) == 0: + yield line else: # Less indented than the first line - stop dedenting yield line