Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gevent
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gevent
Commits
bb20975f
Commit
bb20975f
authored
Nov 13, 2015
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add changelog and test for #687
parent
25f5298c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
2 deletions
+36
-2
changelog.rst
changelog.rst
+6
-2
gevent/hub.py
gevent/hub.py
+4
-0
greentest/test__monkey_hub_in_thread.py
greentest/test__monkey_hub_in_thread.py
+26
-0
No files found.
changelog.rst
View file @
bb20975f
...
...
@@ -21,10 +21,14 @@
callback function behave like the CPython implementation: the
exception is printed, and the rest of the callbacks continue
processing.
- If a Hub object with active watchers
,
was destroyed and then another
one created for the same thread which itself was then destroyed with
- If a Hub object with active watchers was destroyed and then another
one created for the same thread
,
which itself was then destroyed with
``destroy_loop=True``, the process could crash. Documented in
: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)
====================
...
...
gevent/hub.py
View file @
bb20975f
...
...
@@ -67,6 +67,10 @@ threadlocal = thread._local
class
_threadlocal
(
threadlocal
):
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
)
self
.
Hub
=
None
self
.
loop
=
None
...
...
greentest/test__monkey_hub_in_thread.py
0 → 100644
View file @
bb20975f
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
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment