Be more aggressive when trying to figure out why there are duplicates

This commit is contained in:
Vgr E. Barry 2017-02-02 20:59:37 -05:00
parent 0ef70245ff
commit 48e1f06b33

View File

@ -74,13 +74,14 @@ def _get(nick=None, ident=None, host=None, realname=None, account=None, *, allow
if len(potential) > 1:
# XXX Debugging aid for when this fails (and we can't figure out why)
import gc
import sys, gc
all_refs = []
for user in potential:
for ref in gc.get_referrers(user):
for name, thing in var.__dict__.items():
if ref is thing: # Found it!
all_refs.append((user, name))
for mod_name, module in sys.modules.items():
for var_name, variable in module.__dict__.items():
if ref is variable: # Found it!
all_refs.append((user, mod_name, name))
break
raise ValueError("More than one user matches: " +