Compare commits

...

1 Commits
master ... f17

Author SHA1 Message Date
Pádraig Brady
a9feed2c52 fix base exception type thrown
See: http://pad.lv/1097203
2013-01-18 14:50:23 +00:00
2 changed files with 42 additions and 1 deletions

34
base-exception.patch Normal file
View File

@ -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@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

View File

@ -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@draigBrady.com> - 0.3.1-12
- Fix base exception type thrown
* Thu Oct 11 2012 Pádraig Brady <P@draigBrady.com> - 0.3.1-11
- Add support for ppc64