patcher: green existing locks fail (Python3)

Introduced in #309, this enumeration should be over the items of the
dict in order to work correctly.

https://github.com/eventlet/eventlet/pull/356
https://github.com/eventlet/eventlet/pull/309
This commit is contained in:
Whitney Young 2016-11-30 14:34:14 -08:00 committed by Sergey Shepelev
parent f508a7e330
commit 32e2c335fb
1 changed files with 8 additions and 3 deletions

View File

@ -372,9 +372,14 @@ def _fix_py3_rlock(old):
new.acquire()
gc.collect()
for ref in gc.get_referrers(old):
for k, v in vars(ref):
if v == old:
setattr(ref, k, new)
try:
ref_vars = vars(ref)
except TypeError:
pass
else:
for k, v in ref_vars.items():
if v == old:
setattr(ref, k, new)
def _green_os_modules():