summaryrefslogtreecommitdiff
path: root/eventlet/green/threading.py
diff options
context:
space:
mode:
authorJakub Stasiak <jakub@stasiak.at>2014-11-11 22:38:30 +0000
committerJakub Stasiak <jakub@stasiak.at>2014-11-11 22:47:09 +0000
commite843a8ace3c2f37d2e47fc0b4a4dabd126411750 (patch)
treec37533d832dc6ff6532fb4fc9c433ba1aa63ef6f /eventlet/green/threading.py
parent67cde41d03c0bccb12fd7d5f6d7e155d6da95e40 (diff)
downloadeventlet-python3-clean-clean.tar.gz
Python 3 compat; Improve WSGI, WS, threading and testspython3-clean-clean
This includes: * patching more tests to pass * removing few unit tests which I think are redundant * repeating SSL socket reads in a loop to read all data (I suspect this is related to the fact that writelines is used in the server code there and Python 3 writelines calls write/send repeatedly while on Python 2 it calls it once; on one hand there's no guarantee that single recv/read will return all data sent by the server, on the other hand it's quite suspicious that the number of required reads seems to be connected to the number of sends on the other side of the connection) * working through Python 2/Python 3 threading and thread differences; the lock code I used is the simplest way I could make the tests pass but will likely need to be modified in order to match the original This commit includes 6bcb1dc and closes GH #153
Diffstat (limited to 'eventlet/green/threading.py')
-rw-r--r--eventlet/green/threading.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/eventlet/green/threading.py b/eventlet/green/threading.py
index 5c56ba1..3176261 100644
--- a/eventlet/green/threading.py
+++ b/eventlet/green/threading.py
@@ -2,12 +2,17 @@
from eventlet import patcher
from eventlet.green import thread
from eventlet.green import time
-from eventlet.support import greenlets as greenlet
+from eventlet.support import greenlets as greenlet, six
-__patched__ = ['_start_new_thread', '_allocate_lock', '_get_ident', '_sleep',
- 'local', 'stack_size', 'Lock', 'currentThread',
+__patched__ = ['_start_new_thread', '_allocate_lock',
+ '_sleep', 'local', 'stack_size', 'Lock', 'currentThread',
'current_thread', '_after_fork', '_shutdown']
+if six.PY2:
+ __patched__ += ['_get_ident']
+else:
+ __patched__ += ['get_ident', '_set_sentinel']
+
__orig_threading = patcher.original('threading')
__threadlocal = __orig_threading.local()
@@ -15,7 +20,7 @@ __threadlocal = __orig_threading.local()
patcher.inject(
'threading',
globals(),
- ('thread', thread),
+ ('thread' if six.PY2 else '_thread', thread),
('time', time))
del patcher