summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDina Belova <dbelova@mirantis.com>2016-02-09 13:42:22 -0800
committerDina Belova <dbelova@mirantis.com>2016-02-09 13:42:22 -0800
commitac45be4bf09bbefd4e64d6d5148305f9af21f06d (patch)
tree12ebc5fd6d5584b5f1cf9ef1f593c460ab5dcb80
parent2d57f411a3b9b0fa62eff46ecde724ef92787402 (diff)
downloadosprofiler-ac45be4bf09bbefd4e64d6d5148305f9af21f06d.tar.gz
Make class detection more accurate
It's more correct to use inspect.isclass(X) instead of type(X) == type as if some parent of the class we're trying to trace has metaclass used, the type will be that metaclass. Change-Id: I5102eb46a7a377eca31375a0d64951ba1fdd035d
-rw-r--r--osprofiler/profiler.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/osprofiler/profiler.py b/osprofiler/profiler.py
index 1764184..7e2c9b1 100644
--- a/osprofiler/profiler.py
+++ b/osprofiler/profiler.py
@@ -148,7 +148,7 @@ def trace_cls(name, info=None, hide_args=False, trace_private=False):
"""
def decorator(cls):
- clss = cls if type(cls) is type else cls.__class__
+ clss = cls if inspect.isclass(cls) else cls.__class__
mro_dicts = [c.__dict__ for c in inspect.getmro(clss)]
for attr_name, attr in inspect.getmembers(cls):
if not (inspect.ismethod(attr) or inspect.isfunction(attr)):