From 48e1f06b3358aa1421ad2ce04b25fc089911e1fd Mon Sep 17 00:00:00 2001 From: "Vgr E. Barry" Date: Thu, 2 Feb 2017 20:59:37 -0500 Subject: [PATCH] Be more aggressive when trying to figure out why there are duplicates --- src/users.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/users.py b/src/users.py index 7400015..15ab083 100644 --- a/src/users.py +++ b/src/users.py @@ -74,14 +74,15 @@ 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)) - break + 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: " + _arg_msg.format(nick, ident, host, realname, account, allow_bot))