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