Announcing Greenlet 0.3

I’ve just released greenlet 0.3 on pypi. which has some bug fixes and a couple of new features.

Python 3 support

Greenlet now supports Python 3, and has been tested on Python 2.4, 2.5, 2.6, 3.0 and 3.1 on all platforms I have access to (x86 and amd64 GNU/Linux, x86 Windows, and Mac OS X Leopard).

Existing tests were rewritten so that they could be run without nose, since there is currently no stable release of nose for Python 3.

switch() now accepts keyword arguments

This is from the DWIM department. The switch method will now do what you expect with the arguments it receives.

>>> greenlet.greenlet(lambda: greenlet.getcurrent().switch()).switch()
>>> greenlet.greenlet(lambda: greenlet.getcurrent().switch(1)).switch()
>>> greenlet.greenlet(lambda: greenlet.getcurrent().switch(1, 2)).switch()
(1, 2)
>>> greenlet.greenlet(lambda: greenlet.getcurrent().switch(a=5)).switch()
{'a': 5}
>>> greenlet.greenlet(lambda: greenlet.getcurrent().switch(1, 2, a=5)).switch()
((1, 2), {'a': 5})


If you are writing an extension module, you can now use the provided header file to import greenlet, create greenlet objects and modify them directly from C.

PyObject *callable = ...
PyGreenlet *g = PyGreenlet_New(callable, NULL);
PyGreenlet_Switch(g, NULL, NULL);
    Py_BuildValue("s", "error message"),

See the documentation for a full API reference.

Platform updates

  • Linux mips support from Thiemo Seufer
  • MingGW GCC 4.4 support from Giovanni Bajo
  • Arm32 support from Sylvain Baro
  • Fixed Python 2.6 support on Windows from Armin Rigo

Bugs fixed

  • Switching to a new inactive greenlet created in another thread no longer crashes Python.
  • Fix for issue #40 from py lib to fix a threading bug. Patch from Armin Rigo and ghazel.

Documentation and tests

This release tripled the number of unit tests, and includes updated documentation based on the docs that used to be included in the py lib.

Known issues

  • #4: Build currently broken on Solaris Spark
  • #2: No support for x64 Windows
  • #5: No GC support. Creating reference cycles that include data in the stack frame of a greenlet can lead to leaks.

Getting greenlet

On most platforms, getting greenlet is easy. Just use pip or easy_install.

pip install --upgrade greenlet
easy_install -U greenlet

On Windows installing greenlet can be kind of tricky, since (without hackery) Visual Studio 2003 is required for Python versions < 2.6, and Visual Studio 2008 is required for later versions. For those who don’t want to go through the trouble, I’ve uploaded binary eggs and installers for x86 Windows to pypi, and the download page.

If you would like to report any bugs or request a feature, please create a new issue on bitbucket.


Tags: ,

6 Responses to “Announcing Greenlet 0.3”

  1. Donovan Preston Says:

    Dude! Awesome!

    Thanks especially for the C API. It would be really helpful to me if there was also C API for registering non-python callbacks. void (*callback)(void * data) which could make greenlet useful even without the presence of Python.h.

  2. Tweets that mention Announcing Greenlet 0.3 « Ambroff's Log -- Says:

    […] This post was mentioned on Twitter by Denis Bilenko, Denis Bilenko and Kyle Ambroff, Nicholas Piël. Nicholas Piël said: RT @ambroff: Just released Greenlet 0.3: (via @gevent) […]

  3. Paolo Losi Says:

    Thanks for your work!

  4. Christoph Gohlke Says:

    What is the state of the x64 Windows port? A while ago I have ported greenlet-0.2 to win-amd64 using code from stackless. I could attempt to do it again for greenlet 0.3.

  5. Dudley Dhar Says:

    Great post! Keep up the good work

  6. Sufi Hani Says:

    Wanted to know the state of Solaris 10 SPARC Build :(.. only servers we have in my company… ;(

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: