Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Fixed a buncha things noticed during a code review.

  • Loading branch information...
1 parent eabca6b commit 8dc1dd621c1d8be58f610d1334f36a34d1a3e340 @whichlinden whichlinden committed
@@ -1,21 +1,24 @@
+* tpooled gethostbyname is configurable via environment variable EVENTLET_TPOOL_GETHOSTBYNAME
+* Removed greenio.Green_fileobject and refactored the code therein to be more efficient. Only call makefile() on sockets now; makeGreenFile() is deprecated. The main loss here is that of the readuntil method. Also, Green_fileobjects used to be auto-flushing; flush() must be called explicitly now.
+* Improved documentation across the board.
* New debug module, used for enabling verbosity within Eventlet that can help debug applications or Eventlet itself.
-* Bugfixes in tpool,
+* Bugfixes in tpool,, patcher
* Moved primary api module to __init__ from api. It shouldn't be necessary to import eventlet.api anymore; import eventlet should do the same job.
* Proc module deprecated in favor of greenthread
* New module greenthread, with new class GreenThread.
* New GreenPool class that replaces pool.Pool.
-* Deprecated coros.execute
-* Deprecated coros.semaphore
+* Deprecated Proc module (use greenthread module instead)
+* Deprecated coros.execute (use eventlet.spawn instead)
+* Deprecated coros.semaphore (use semaphore.Semaphore or semaphore.BoundedSemaphore instead)
* Moved coros.BoundedSemaphore to semaphore.BoundedSemaphore
* Moved coros.Semaphore to semaphore.Semaphore
* Moved coros.event to event.Event
* Deprecated api.tcp_listener, api.connect_tcp, api.ssl_listener
-* Moved get_hub, use_hub, get_default_hub to eventlet.hubs
+* Moved get_hub, use_hub, get_default_hub from eventlet.api to eventlet.hubs
* Renamed libevent hub to pyevent.
-* Renamed coros.event to coros.Event
* Removed previously-deprecated features tcp_server, GreenSSL, erpc, and trap_errors.
* Removed saranwrap as an option for making db connections nonblocking in db_pool.
8 README.twisted
@@ -12,12 +12,14 @@ Eventlet on top of twisted provides:
* existing twisted code can be used without any changes
* existing blocking code can be used after trivial changes applied
+NOTE: the maintainer of Eventlet's Twisted support no longer supports it; it still exists but may have had some breakage along the way. Please treat it as experimental, and if you'd like to maintain it, please do!
Eventlet features:
* utilities for spawning and controlling greenlet execution:
api.spawn, api.kill, proc module
* utilities for communicating between greenlets:
- coros.Event, coros.Queue, proc module
+ event.Event, queue.Queue, semaphore.Semaphore
* standard Python modules that won't block the reactor: package
* utilities specific to twisted hub:
@@ -61,8 +63,8 @@ to call from anywhere:
1. Greenlet creation functions: api.spawn, proc.spawn,
twistedutil.deferToGreenThread and others based on api.spawn.
-2. send(), send_exception(), poll(), ready() methods of coros.Event
- and coros.Queue.
+2. send(), send_exception(), poll(), ready() methods of event.Event
+ and queue.Queue.
3. wait(timeout=0) is identical to poll(). Currently only Proc.wait
supports timeout parameter.
8 eventlet/twistedutil/
@@ -9,7 +9,7 @@
from eventlet import proc
from eventlet.api import getcurrent
from eventlet.coros import Queue
-from eventlet.event import Event
+from eventlet.event import Event as BaseEvent
class ValueQueue(Queue):
@@ -37,17 +37,17 @@ def has_error(self):
return self.items and self.items[-1][1] is not None
-class Event(Event):
+class Event(BaseEvent):
def send(self, value, exc=None):
if self.ready():
- return Event.send(self, value, exc)
+ return BaseEvent.send(self, value, exc)
def send_exception(self, *throw_args):
if self.ready():
- return Event.send_exception(self, *throw_args)
+ return BaseEvent.send_exception(self, *throw_args)
class Producer2Event(object):
13 tests/
@@ -2,7 +2,8 @@
from tests import skipped, skip_unless
from unittest import TestCase, main
-from eventlet import api, coros
+from eventlet import api
+from eventlet import event
from eventlet import db_pool
class DBTester(object):
@@ -146,13 +147,13 @@ def test_returns_immediately(self):
curs = conn.cursor()
results = []
SHORT_QUERY = "select * from test_table"
- evt = coros.Event()
+ evt = event.Event()
def a_query():
- evt2 = coros.Event()
+ evt2 = event.Event()
self.assertEqual([1], results)
@@ -223,13 +224,13 @@ def test_two_simultaneous_connections(self):
LONG_QUERY = "select * from test_table"
SHORT_QUERY = "select * from test_table where row_id <= 20"
- evt = coros.Event()
+ evt = event.Event()
def long_running_query():
- evt2 = coros.Event()
+ evt2 = event.Event()
def short_running_query():
@@ -373,7 +374,7 @@ def test_waiters_get_woken(self):
conn = self.pool.get()
self.assertEquals(, 0)
self.assertEquals(self.pool.waiting(), 0)
- e = coros.Event()
+ e = event.Event()
def retrieve(pool, ev):
c = pool.get()

0 comments on commit 8dc1dd6

Please sign in to comment.
Something went wrong with that request. Please try again.