[python-greenlet/el6: 1/2] fix base exception type thrown

Pádraig Brady pbrady at fedoraproject.org
Fri Jan 18 14:52:42 UTC 2013


commit a9feed2c525dda14317bd49f4da6d435aeeaf16c
Author: Pádraig Brady <P at draigBrady.com>
Date:   Fri Jan 18 14:48:46 2013 +0000

    fix base exception type thrown
    
    See: http://pad.lv/1097203

 base-exception.patch |   34 ++++++++++++++++++++++++++++++++++
 python-greenlet.spec |    9 ++++++++-
 2 files changed, 42 insertions(+), 1 deletions(-)
---
diff --git a/base-exception.patch b/base-exception.patch
new file mode 100644
index 0000000..a8742c3
--- /dev/null
+++ b/base-exception.patch
@@ -0,0 +1,34 @@
+wget https://github.com/python-greenlet/greenlet/commit/2f81f5d.patch
+
+From 2f81f5de275c8dad13c5497c540ab96952a24071 Mon Sep 17 00:00:00 2001
+From: Alexey Borzenkov <snaury at gmail.com>
+Date: Mon, 28 Feb 2011 00:48:00 +0300
+Subject: [PATCH] Make GreenletExit based on BaseException on Python >= 2.5
+
+This way it is more similar to SystemExit and becomes a little
+harder to accidentally catch with "except Exception:" statement.
+---
+ greenlet.c |    5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/greenlet.c b/greenlet.c
+index 25358ce..973a12c 100755
+--- a/greenlet.c
++++ b/greenlet.c
+@@ -1266,8 +1266,13 @@ void initgreenlet(void)
+ 	{
+ 		INITERROR;
+ 	}
++#if PY_MAJOR_VERSION >= 3 || (PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 5)
++	PyExc_GreenletExit = PyErr_NewException("greenlet.GreenletExit",
++						PyExc_BaseException, NULL);
++#else
+ 	PyExc_GreenletExit = PyErr_NewException("greenlet.GreenletExit",
+ 						NULL, NULL);
++#endif
+ 	if (PyExc_GreenletExit == NULL)
+ 	{
+ 		INITERROR;
+-- 
+1.7.10
+
diff --git a/python-greenlet.spec b/python-greenlet.spec
index 9b1aacc..687ea4e 100644
--- a/python-greenlet.spec
+++ b/python-greenlet.spec
@@ -4,7 +4,7 @@
 
 Name:           python-greenlet
 Version:        0.3.1
-Release:        11%{?dist}
+Release:        12%{?dist}
 Summary:        Lightweight in-process concurrent programming
 Group:          Development/Libraries
 License:        MIT
@@ -20,6 +20,9 @@ Patch2:         i686-register-fixes.patch
 # Backport https://github.com/python-greenlet/greenlet/commit/b17773a7
 # from greenlet 0.4.0 to support ppc64
 Patch3:         ppc64-support.patch
+# Backport https://github.com/python-greenlet/greenlet/commit/2f81f5d
+# from greenlet 0.3.2 to fix http://pad.lv/1097203
+Patch4:         base-exception.patch
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
@@ -45,6 +48,7 @@ This package contains header files required for C modules development.
 %patch1 -p1 -b .get-rid-of-ts_origin
 %patch2 -p1 -b .i686_register_fixes
 %patch3 -p1 -b .ppc64_support
+%patch4 -p1 -b .base_exception
 
 %build
 CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build
@@ -81,6 +85,9 @@ PYTHONPATH=$(pwd) %{__python} benchmarks/switch.py
 %{_includedir}/python*/greenlet
 
 %changelog
+* Fri Jan 18 2013 Pádraig Brady <P at draigBrady.com> - 0.3.1-12
+- Fix base exception type thrown
+
 * Thu Oct 11 2012 Pádraig Brady <P at draigBrady.com> - 0.3.1-11
 - Add support for ppc64
 


More information about the scm-commits mailing list