Accepting request 142579 from devel:languages:python

- Update to version 0.4.0:
  + Greenlet has an instance dictionary now, which means it can be
    used for implementing greenlet local storage, etc. However, this
    might introduce incompatibility if subclasses have __dict__ in their
    __slots__. Classes like that will fail, because greenlet already
    has __dict__ out of the box.
  + Greenlet no longer leaks memory after thread termination, as long as
    terminated thread has no running greenlets left at the time.
  + Add support for debian sparc and openbsd5-sparc64
  + Add support for ppc64 linux
  + Don't allow greenlets to be copied with copy.copy/deepcopy
  + Fix arm32/thumb support
  + Restore greenlet's parent after kill
  + Add experimental greenlet tracing
- Changes from version 0.3.4:
  + Use plain distutils for install command, this fixes installation of
    the greenlet.h header.
  + Enhanced arm32 support
  + Fix support for Linux/S390 zSeries
  + Workaround compiler bug on RHEL 3 / CentOS 3
- Changes from version 0.3.3:
  + Use sphinx to build documentation and publish it on greenlet.rtfd.org
  + Prevent segfaults on openbsd 4/i386
  + Workaround gcc-4.0 not allowing to clobber rbx
  + Enhance test infrastructure
  + Fix possible compilation problems when including greenlet.h in C++ mode
  + Make the greenlet module work on x64 windows
  + Add a test for greenlet C++ exceptions
  + Fix compilation on Solaris with SunStudio
- Changes from version 0.3.2:

OBS-URL: https://build.opensuse.org/request/show/142579
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-greenlet?expand=0&rev=8
This commit is contained in:
Stephan Kulow 2012-11-25 12:40:36 +00:00 committed by Git OBS Bridge
commit 25f1f81287
8 changed files with 63 additions and 299 deletions

View File

@ -1,106 +0,0 @@
diff -up greenlet-0.3.1/greenlet.c.get-rid-of-ts_origin greenlet-0.3.1/greenlet.c
--- greenlet-0.3.1/greenlet.c.get-rid-of-ts_origin 2010-04-05 17:24:25.000000000 -0400
+++ greenlet-0.3.1/greenlet.c 2011-10-19 13:59:30.485035920 -0400
@@ -116,10 +116,8 @@ extern PyTypeObject PyGreenlet_Type;
/* The current greenlet in this thread state (holds a reference) */
static PyGreenlet* ts_current = NULL;
-/* Holds a reference to the switching-from stack during the slp switch */
-static PyGreenlet* ts_origin = NULL;
/* Holds a reference to the switching-to stack during the slp switch */
-static PyGreenlet* ts_target = NULL;
+static PyGreenlet* volatile ts_target = NULL;
/* NULL if error, otherwise args tuple to pass around during slp switch */
static PyObject* ts_passaround_args = NULL;
static PyObject* ts_passaround_kwargs = NULL;
@@ -257,6 +255,7 @@ static int g_save(PyGreenlet* g, char* s
static void slp_restore_state(void)
{
PyGreenlet* g = ts_target;
+ PyGreenlet* owner = ts_current;
/* Restore the heap copy back into the C stack */
if (g->stack_saved != 0) {
@@ -265,30 +264,32 @@ static void slp_restore_state(void)
g->stack_copy = NULL;
g->stack_saved = 0;
}
- if (ts_current->stack_stop == g->stack_stop)
- g->stack_prev = ts_current->stack_prev;
- else
- g->stack_prev = ts_current;
+ if (owner->stack_start == NULL)
+ owner = owner->stack_prev; /* greenlet is dying, skip it */
+ while (owner && owner->stack_stop <= g->stack_stop)
+ owner = owner->stack_prev; /* find greenlet with more stack */
+ g->stack_prev = owner;
}
static int slp_save_state(char* stackref)
{
/* must free all the C stack up to target_stop */
char* target_stop = ts_target->stack_stop;
- assert(ts_current->stack_saved == 0);
- if (ts_current->stack_start == NULL)
- ts_current = ts_current->stack_prev; /* not saved if dying */
+ PyGreenlet* owner = ts_current;
+ assert(owner->stack_saved == 0);
+ if (owner->stack_start == NULL)
+ owner = owner->stack_prev; /* not saved if dying */
else
- ts_current->stack_start = stackref;
+ owner->stack_start = stackref;
- while (ts_current->stack_stop < target_stop) {
+ while (owner->stack_stop < target_stop) {
/* ts_current is entierely within the area to free */
- if (g_save(ts_current, ts_current->stack_stop))
+ if (g_save(owner, owner->stack_stop))
return -1; /* XXX */
- ts_current = ts_current->stack_prev;
+ owner = owner->stack_prev;
}
- if (ts_current != ts_target) {
- if (g_save(ts_current, target_stop))
+ if (owner != ts_target) {
+ if (g_save(owner, target_stop))
return -1; /* XXX */
}
return 0;
@@ -337,11 +338,11 @@ static int g_switchstack(void)
*/
int err;
{ /* save state */
+ PyGreenlet* current = ts_current;
PyThreadState* tstate = PyThreadState_GET();
- ts_current->recursion_depth = tstate->recursion_depth;
- ts_current->top_frame = tstate->frame;
+ current->recursion_depth = tstate->recursion_depth;
+ current->top_frame = tstate->frame;
}
- ts_origin = ts_current;
err = _PyGreenlet_slp_switch();
if (err < 0) { /* error */
Py_XDECREF(ts_passaround_args);
@@ -351,13 +352,15 @@ static int g_switchstack(void)
ts_passaround_kwargs = NULL;
}
else {
+ PyGreenlet* target = ts_target;
+ PyGreenlet* origin = ts_current;
PyThreadState* tstate = PyThreadState_GET();
- tstate->recursion_depth = ts_target->recursion_depth;
- tstate->frame = ts_target->top_frame;
- ts_target->top_frame = NULL;
- ts_current = ts_target;
- Py_INCREF(ts_target);
- Py_DECREF(ts_origin);
+ tstate->recursion_depth = target->recursion_depth;
+ tstate->frame = target->top_frame;
+ target->top_frame = NULL;
+ ts_current = target;
+ Py_INCREF(target);
+ Py_DECREF(origin);
}
return err;
}

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:63a0a9b3a59d5413741f81d021fc6c292364953ea8dddd71ac129d77b9b143da
size 39037

3
greenlet-0.4.0.zip Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3f52af03bf8a89045fc159c6a76d5642349b30fb41c3df1a22b12bbd3920b1ee
size 72790

View File

@ -1,62 +0,0 @@
# HG changeset patch
# User Alexey Borzenkov <snaury@gmail.com>
# Date 1313701525 -14400
# Node ID 25bf29f4d3b79b026c1c05787bb741a8e7ef2229
# Parent c0bf397a723d4b61d7ef78cf575dea4c0fdb527e
Fix compilation and register problems on some i386 configurations
diff -r c0bf397a723d4b61d7ef78cf575dea4c0fdb527e -r 25bf29f4d3b79b026c1c05787bb741a8e7ef2229 platform/switch_x86_unix.h
--- a/platform/switch_x86_unix.h Thu Aug 18 02:44:20 2011 +0400
+++ b/platform/switch_x86_unix.h Fri Aug 19 01:05:25 2011 +0400
@@ -2,6 +2,8 @@
* this is the internal transfer function.
*
* HISTORY
+ * 19-Aug-11 Alexey Borzenkov <snaury@gmail.com>
+ * Correctly save ebp, ebx and cw
* 07-Sep-05 (py-dev mailing list discussion)
* removed 'ebx' from the register-saved. !!!! WARNING !!!!
* It means that this file can no longer be compiled statically!
@@ -34,18 +36,13 @@
static int
slp_switch(void)
{
+ void *ebp, *ebx;
+ unsigned short cw;
register int *stackref, stsizediff;
- /* !!!!WARNING!!!! need to add "ebx" in the next line, as well as in the
- * last line of this function, if this header file is meant to be compiled
- * non-dynamically!
- */
- __asm__ volatile ("" : : :
- "esi",
- "edi"
-#ifdef __MINGW32__
- , "ebx"
-#endif
- );
+ __asm__ volatile ("" : : : "esi", "edi");
+ __asm__ volatile ("fstcw %0" : "=m" (cw));
+ __asm__ volatile ("movl %%ebp, %0" : "=m" (ebp));
+ __asm__ volatile ("movl %%ebx, %0" : "=m" (ebx));
__asm__ ("movl %%esp, %0" : "=g" (stackref));
{
SLP_SAVE_STATE(stackref, stsizediff);
@@ -57,13 +54,10 @@
);
SLP_RESTORE_STATE();
}
- __asm__ volatile ("" : : :
- "esi",
- "edi"
-#ifdef __MINGW32__
- , "ebx"
-#endif
- );
+ __asm__ volatile ("movl %0, %%ebx" : : "m" (ebx));
+ __asm__ volatile ("movl %0, %%ebp" : : "m" (ebp));
+ __asm__ volatile ("fldcw %0" : : "m" (cw));
+ __asm__ volatile ("" : : : "esi", "edi");
return 0;
}

View File

@ -1,21 +0,0 @@
Index: greenlet-0.3.1/platform/switch_ppc_unix.h
===================================================================
--- greenlet-0.3.1.orig/platform/switch_ppc_unix.h
+++ greenlet-0.3.1/platform/switch_ppc_unix.h
@@ -42,7 +42,7 @@
* is meant to be compiled non-dynamically!
*/
#define REGS_TO_SAVE "r13", "r14", "r15", "r16", "r17", "r18", "r19", "r20", \
- "r21", "r22", "r23", "r24", "r25", "r26", "r27", "r28", "r29", \
+ "r21", "r22", "r23", "r24", "r25", "r26", "r27", "r28", "r29", "r31", \
"cr2", "cr3", "cr4"
static int
slp_switch(void)
@@ -55,7 +55,6 @@ slp_switch(void)
__asm__ volatile (
"mr 11, %0\n"
"add 1, 1, 11\n"
- "add 30, 30, 11\n"
: /* no outputs */
: "g" (stsizediff)
: "11"

View File

@ -1,88 +0,0 @@
Index: greenlet-0.3.1/platform/switch_ppc64_linux.h
===================================================================
--- /dev/null
+++ greenlet-0.3.1/platform/switch_ppc64_linux.h
@@ -0,0 +1,70 @@
+/*
+ * this is the internal transfer function.
+ *
+ * HISTORY
+ * 09-Mar-12 Michael Ellerman <michael@ellerman.id.au>
+ * 64-bit implementation, copied from 32-bit.
+ * 07-Sep-05 (py-dev mailing list discussion)
+ * removed 'r31' from the register-saved. !!!! WARNING !!!!
+ * It means that this file can no longer be compiled statically!
+ * It is now only suitable as part of a dynamic library!
+ * 14-Jan-04 Bob Ippolito <bob@redivi.com>
+ * added cr2-cr4 to the registers to be saved.
+ * Open questions: Should we save FP registers?
+ * What about vector registers?
+ * Differences between darwin and unix?
+ * 24-Nov-02 Christian Tismer <tismer@tismer.com>
+ * needed to add another magic constant to insure
+ * that f in slp_eval_frame(PyFrameObject *f)
+ * STACK_REFPLUS will probably be 1 in most cases.
+ * gets included into the saved stack area.
+ * 04-Oct-02 Gustavo Niemeyer <niemeyer@conectiva.com>
+ * Ported from MacOS version.
+ * 17-Sep-02 Christian Tismer <tismer@tismer.com>
+ * after virtualizing stack save/restore, the
+ * stack size shrunk a bit. Needed to introduce
+ * an adjustment STACK_MAGIC per platform.
+ * 15-Sep-02 Gerd Woetzel <gerd.woetzel@GMD.DE>
+ * slightly changed framework for sparc
+ * 29-Jun-02 Christian Tismer <tismer@tismer.com>
+ * Added register 13-29, 31 saves. The same way as
+ * Armin Rigo did for the x86_unix version.
+ * This seems to be now fully functional!
+ * 04-Mar-02 Hye-Shik Chang <perky@fallin.lv>
+ * Ported from i386.
+ */
+
+#define STACK_REFPLUS 1
+
+#ifdef SLP_EVAL
+
+#define STACK_MAGIC 6
+
+/* !!!!WARNING!!!! need to add "r31" in the next line if this header file
+ * is meant to be compiled non-dynamically!
+ */
+#define REGS_TO_SAVE "r2", "r14", "r15", "r16", "r17", "r18", "r19", "r20", \
+ "r21", "r22", "r23", "r24", "r25", "r26", "r27", "r28", "r29", "r31", \
+ "cr2", "cr3", "cr4"
+static int
+slp_switch(void)
+{
+ register long *stackref, stsizediff;
+ __asm__ volatile ("" : : : REGS_TO_SAVE);
+ __asm__ ("mr %0, 1" : "=g" (stackref) : );
+ {
+ SLP_SAVE_STATE(stackref, stsizediff);
+ __asm__ volatile (
+ "mr 11, %0\n"
+ "add 1, 1, 11\n"
+ : /* no outputs */
+ : "g" (stsizediff)
+ : "11"
+ );
+ SLP_RESTORE_STATE();
+ }
+ __asm__ volatile ("" : : : REGS_TO_SAVE);
+ return 0;
+}
+
+#endif
Index: greenlet-0.3.1/slp_platformselect.h
===================================================================
--- greenlet-0.3.1.orig/slp_platformselect.h
+++ greenlet-0.3.1/slp_platformselect.h
@@ -8,6 +8,8 @@
#include "platform/switch_amd64_unix.h" /* gcc on amd64 */
#elif defined(__GNUC__) && defined(__i386__)
#include "platform/switch_x86_unix.h" /* gcc on X86 */
+#elif defined(__GNUC__) && defined(__powerpc64__) && defined(__linux__)
+#include "platform/switch_ppc64_linux.h" /* gcc on PowerPC 64-bit */
#elif defined(__GNUC__) && defined(__PPC__) && defined(__linux__)
#include "platform/switch_ppc_unix.h" /* gcc on PowerPC */
#elif defined(__GNUC__) && defined(__ppc__) && defined(__APPLE__)

View File

@ -1,3 +1,53 @@
-------------------------------------------------------------------
Fri Nov 23 12:05:16 UTC 2012 - saschpe@suse.de
- Update to version 0.4.0:
+ Greenlet has an instance dictionary now, which means it can be
used for implementing greenlet local storage, etc. However, this
might introduce incompatibility if subclasses have __dict__ in their
__slots__. Classes like that will fail, because greenlet already
has __dict__ out of the box.
+ Greenlet no longer leaks memory after thread termination, as long as
terminated thread has no running greenlets left at the time.
+ Add support for debian sparc and openbsd5-sparc64
+ Add support for ppc64 linux
+ Don't allow greenlets to be copied with copy.copy/deepcopy
+ Fix arm32/thumb support
+ Restore greenlet's parent after kill
+ Add experimental greenlet tracing
- Changes from version 0.3.4:
+ Use plain distutils for install command, this fixes installation of
the greenlet.h header.
+ Enhanced arm32 support
+ Fix support for Linux/S390 zSeries
+ Workaround compiler bug on RHEL 3 / CentOS 3
- Changes from version 0.3.3:
+ Use sphinx to build documentation and publish it on greenlet.rtfd.org
+ Prevent segfaults on openbsd 4/i386
+ Workaround gcc-4.0 not allowing to clobber rbx
+ Enhance test infrastructure
+ Fix possible compilation problems when including greenlet.h in C++ mode
+ Make the greenlet module work on x64 windows
+ Add a test for greenlet C++ exceptions
+ Fix compilation on Solaris with SunStudio
- Changes from version 0.3.2:
+ Fix various crashes with recent gcc versions and VC90
+ Try to fix stack save/restore on arm32
+ Store and restore the threadstate on exceptions like pypy/stackless do
+ GreenletExit is now based on BaseException on Python >= 2.5
+ Switch to using PyCapsule for Python 2.7 and 3.1
+ Port for AIX on PowerPC
+ Fix the sparc/solaris header
+ Improved build dependencies patch from flub.
+ Can't pass parent=None to greenlet.greenlet() (fixes #21)
+ Rudimentary gc support (only non-live greenlets are garbage collected though)
- Dropped the following patches (merged upstream):
+ get-rid-of-ts_origin.patch
+ i686-register-fixes.patch
+ ppc-support.patch
+ ppc64-support.patch
- Build HTML documentation
-------------------------------------------------------------------
Tue Jul 3 09:53:32 UTC 2012 - dvaleev@suse.com

View File

@ -17,28 +17,22 @@
#
Name: python-greenlet
Version: 0.3.1
Version: 0.4.0
Release: 0
URL: http://pypi.python.org/pypi/greenlet
Summary: Lightweight in-process concurrent programming
License: MIT
Group: Development/Libraries/Python
Source0: http://pypi.python.org/packages/source/g/greenlet/greenlet-%{version}.tar.gz
# PATCH-FIX-UPSTREAM idoenmez@suse.de i686-register-fixes.patch -- Upstream commit 25bf29f4d3b7
Patch1: i686-register-fixes.patch
# PATCH-FIX-UPSTREAM idoenmez@suse.de get-rid-of-ts_origin.patch -- Upstream commit 2d5b17472757
Patch2: get-rid-of-ts_origin.patch
# PATCH-FIX-UPSTREAM dvaleev@suse.com ppc64-support.patch - Upstream commit b17773a780
Patch3: ppc64-support.patch
# PATCH-FIX-OPENSUSE dvaleev@suse.com ppc-support.patch - Fix ppc build (32bit)
Patch4: ppc-support.patch
Source0: http://pypi.python.org/packages/source/g/greenlet/greenlet-%{version}.zip
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: python-devel
BuildRequires: python-distribute
%if 0%{?suse_version}
%py_requires
BuildRequires: unzip
BuildRequires: gcc-c++
BuildRequires: python-Sphinx
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
%{!?python_sitearch: %global python_sitearch %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
%endif
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
%description
The greenlet package is a spin-off of Stackless, a version of CPython
@ -56,13 +50,10 @@ This package contains header files required for C modules development.
%prep
%setup -q -n greenlet-%{version}
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%build
CFLAGS="%{optflags} -fno-strict-aliasing" python setup.py build
CFLAGS="%{optflags}" python setup.py build
cd doc && make html
%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
@ -72,7 +63,7 @@ python setup.py test
%files
%defattr(-,root,root)
%doc AUTHORS NEWS README
%doc AUTHORS NEWS README.rst doc/_build/html
%{python_sitearch}/*
%files devel