mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
Bug 1632974 - Handle case where mach Command conditions don't have a __name__
attribute r=glandium
There are `conditions` in tree that are callables but which don't have a `__name__` attribute; for example, `functools.partial` instances don't have a `__name__` since they're effectively anonymous functions. If you get to this branch and one of your `conditions` are that kind of object then you'll get a confusing error message instead of the understandable one we're trying to produce here, so account for that possibility. Differential Revision: https://phabricator.services.mozilla.com/D72957
This commit is contained in:
parent
c0ccd572ea
commit
233ffddc4d
@ -54,7 +54,7 @@ class MachRegistrar(object):
|
||||
def _condition_failed_message(cls, name, conditions):
|
||||
msg = ['\n']
|
||||
for c in conditions:
|
||||
part = [' %s' % c.__name__]
|
||||
part = [' %s' % getattr(c, '__name__', c)]
|
||||
if c.__doc__ is not None:
|
||||
part.append(c.__doc__)
|
||||
msg.append(' - '.join(part))
|
||||
|
Loading…
Reference in New Issue
Block a user