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

This commit is contained in:
Thomas Spura 2010-08-31 14:30:54 +02:00
parent 0e2e5a7b7c
commit 1745a1c674
2 changed files with 39 additions and 1 deletions

View File

@ -0,0 +1,32 @@
Modified patch from upstream (PyColorize.py was moved):
commit 3323d576db9f982be1ef6d66f7b9e0d0d6fef7db
Author: Thomas Spura <tomspur@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@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()

View File

@ -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@fedoraproject.org> - 0.10-8
- pycolor: wrong filename -> no crash (#628742)
* Wed Jul 21 2010 David Malcolm <dmalcolm@redhat.com> - 0.10-7
- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild