From 1feceea4e81d1944de6355b53a23ed061eaa80fd Mon Sep 17 00:00:00 2001 From: "Aris (Karim) Merchant" Date: Mon, 30 Jul 2018 16:37:22 -0700 Subject: [PATCH] Change callability check TypeErrors are thrown in a wide variety of situations, most of which have nothing to do with calling an uncallable object. The appropriate test is to use the built-in callable() function, which actually tests if the object is callable. --- evennia/commands/cmdset.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/evennia/commands/cmdset.py b/evennia/commands/cmdset.py index c363f87f80..6f127da1c2 100644 --- a/evennia/commands/cmdset.py +++ b/evennia/commands/cmdset.py @@ -296,9 +296,9 @@ class CmdSet(with_metaclass(_CmdSetMeta, object)): result (any): An instantiated Command or the input unmodified. """ - try: + if callable(cmd): return cmd() - except TypeError: + else: return cmd def _duplicate(self):