Commit bb20975f authored by Jason Madden's avatar Jason Madden

Add changelog and test for #687

parent 25f5298c
...@@ -21,10 +21,14 @@ ...@@ -21,10 +21,14 @@
callback function behave like the CPython implementation: the callback function behave like the CPython implementation: the
exception is printed, and the rest of the callbacks continue exception is printed, and the rest of the callbacks continue
processing. processing.
- If a Hub object with active watchers, was destroyed and then another - If a Hub object with active watchers was destroyed and then another
one created for the same thread which itself was then destroyed with one created for the same thread, which itself was then destroyed with
``destroy_loop=True``, the process could crash. Documented in ``destroy_loop=True``, the process could crash. Documented in
:issue:`237` and fix based on :pr:`238`, both by Jan-Philip Gehrcke. :issue:`237` and fix based on :pr:`238`, both by Jan-Philip Gehrcke.
- Python 3: Initializing gevent's hub for the first time in a native
background thread created during import could fail with
``AttributeError`` and ``ImportError``. Reported in :issue:`687` by
Gregory Petukhov.
1.1b6 (Oct 17, 2015) 1.1b6 (Oct 17, 2015)
==================== ====================
......
...@@ -67,6 +67,10 @@ threadlocal = thread._local ...@@ -67,6 +67,10 @@ threadlocal = thread._local
class _threadlocal(threadlocal): class _threadlocal(threadlocal):
def __init__(self): def __init__(self):
# Use a class with an initializer so that we can test
# for 'is None' instead of catching AttributeError, making
# the code cleaner and possibly solving some corner cases
# (like #687)
threadlocal.__init__(self) threadlocal.__init__(self)
self.Hub = None self.Hub = None
self.loop = None self.loop = None
......
from gevent.monkey import patch_all
patch_all(thread=False)
from threading import Thread
import time
# The first time we init the hub is in the native
# thread with time.sleep().
# See #687
def func():
time.sleep()
def main():
threads = []
for _ in range(2):
th = Thread(target=func)
th.start()
threads.append(th)
for th in threads:
th.join()
if __name__ == '__main__':
main()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment