Commit 6bc64ff4 authored by Jason Madden's avatar Jason Madden

correct attribute name under py3

parent 8f5252cd
......@@ -163,15 +163,20 @@ def _patch_existing_locks(threading):
# locked objects...at least if they use `with`. To be sure, we look at every object
# Since we're supposed to be done very early in the process, there shouldn't be
# too many.
# By definition there's only one thread running, so the various
# owner attributes were the old (native) thread id. Make it our
# current greenlet id so that when it wants to unlock and compare
# self.__owner with _get_ident(), they match.
gc = __import__('gc')
for o in gc.get_objects():
if isinstance(o, rlock_type):
if o._RLock__owner is not None:
# By definition there's only one thread running,
# so this was the old (native) thread id. Make
# it our current greenlet id so that when it wants to unlock
# and compare self.__owner with _get_ident(), they match
o._RLock__owner = tid
if hasattr(o, '_owner'): # Py3
if o._owner is not None:
o._owner = tid
else:
if o._RLock__owner is not None:
o._RLock__owner = tid
elif isinstance(o, _ModuleLock):
if o.owner is not None:
o.owner = tid
......
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