[ipython/f14/master] pycolor: wrong filename -> no crash (#628742)

tomspur tomspur at fedoraproject.org
Tue Aug 31 13:00:22 UTC 2010


commit 63b9c2bd8856b315cbb995af46d03e19e33782a8
Author: Thomas Spura <tomspur at fedoraproject.org>
Date:   Tue Aug 31 14:30:54 2010 +0200

    pycolor: wrong filename -> no crash (#628742)

 ipython-0.10-pycolor-wrong-filename.patch |   32 +++++++++++++++++++++++++++++
 ipython.spec                              |    8 ++++++-
 2 files changed, 39 insertions(+), 1 deletions(-)
---
diff --git a/ipython-0.10-pycolor-wrong-filename.patch b/ipython-0.10-pycolor-wrong-filename.patch
new file mode 100644
index 0000000..6418336
--- /dev/null
+++ b/ipython-0.10-pycolor-wrong-filename.patch
@@ -0,0 +1,32 @@
+Modified patch from upstream (PyColorize.py was moved):
+commit 3323d576db9f982be1ef6d66f7b9e0d0d6fef7db
+Author: Thomas Spura <tomspur at fedoraproject.org>
+Date:   Tue Aug 31 14:12:37 2010 +0200
+
+    pycolor: Wrong filename given -> print error
+    
+    When a user wanted to colorize a file, which doesn't exist, IPython
+    would crash. This commit changes this, so the user gets a usefull
+    message about the wrong filename.
+    
+    This fixes RH bug #628742.
+    
+    Signed-off-by: Thomas Spura <tomspur at fedoraproject.org>
+
+diff --git a/IPython/utils/PyColorize.py b/IPython/utils/PyColorize.py
+index 613ae19..1bd9919 100644
+--- a/IPython/PyColorize.py
++++ b/IPython/PyColorize.py
+@@ -277,7 +277,11 @@ If no filename is given, or if filename is -, read standard input."""
+     if fname == '-':
+         stream = sys.stdin
+     else:
+-        stream = file(fname)
++        try:
++            stream = file(fname)
++        except IOError,msg:
++            print msg
++            return
+ 
+     parser = Parser()
+ 
diff --git a/ipython.spec b/ipython.spec
index 9a09152..c9cad24 100644
--- a/ipython.spec
+++ b/ipython.spec
@@ -4,7 +4,7 @@
 
 Name:           ipython
 Version:        0.10
-Release:        7%{?dist}
+Release:        8%{?dist}
 Summary:        An enhanced interactive Python shell
 
 Group:          Development/Libraries
@@ -18,6 +18,8 @@ Source0:        http://ipython.scipy.org/dist/%{name}-%{version}.tar.gz
 Patch0:         %{name}-itpl-external.patch
 # unbundle all current libraries, a similar patch submitted upstream
 Patch1:         %{name}-unbundle-external-module.patch
+# fix for #628742, published on github for inclusion into upstream
+Patch2:         ipython-0.10-pycolor-wrong-filename.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildArch:      noarch
@@ -89,6 +91,7 @@ This package contains the gui of %{name}, which requires wxPython.
 %setup -q
 %patch0 -p1
 %patch1 -p1
+%patch2 -p1
 
 # delete bundling libs
 pushd IPython/external
@@ -204,6 +207,9 @@ rm -rf %{buildroot}
 
 
 %changelog
+* Tue Aug 31 2010 Thomas Spura <tomspur at fedoraproject.org> - 0.10-8
+- pycolor: wrong filename -> no crash (#628742)
+
 * Wed Jul 21 2010 David Malcolm <dmalcolm at redhat.com> - 0.10-7
 - Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild
 


More information about the scm-commits mailing list