[IPython-dev] patch to fix typo bug in ipipe

Paul Mueller gakusei at dakotacom.net
Thu May 17 16:27:58 EDT 2007


Hi,

I happened to find a small bug in ipipe.py (line 1183):
    if mode == "cell" or mode in "header" or mode == "footer":
                              ^^

Using "mode in" on a string has to be a mistake, since mode is used as
an enum and this is the only place in the file it's compared this way.

I've attached a patch to change "in" to "==".

Paul Mueller
-------------- next part --------------
Index: IPython/Extensions/ipipe.py
===================================================================
--- IPython/Extensions/ipipe.py	(revision 2359)
+++ IPython/Extensions/ipipe.py	(working copy)
@@ -1180,7 +1180,7 @@
     except IOError:
         name = "ifile"
         style = astyle.style_default
-    if mode == "cell" or mode in "header" or mode == "footer":
+    if mode == "cell" or mode == "header" or mode == "footer":
         abspath = repr(path._base(self.normpath()))
         if abspath.startswith("u"):
             abspath = abspath[2:-1]


More information about the IPython-dev mailing list