aboutsummaryrefslogtreecommitdiff
path: root/wa/framework
diff options
context:
space:
mode:
authorMarc Bonnici <marc.bonnici@arm.com>2018-09-05 15:25:32 +0100
committersetrofim <setrofim@gmail.com>2018-09-05 15:44:48 +0100
commit8cd79f2ac42bc8586b85d3a16d965aae2b4aedc3 (patch)
tree7b671b9cc4d32ca3d0bc63edcae604d54f5d0b40 /wa/framework
parent6239f6ab2f68ffc32dc812c4f74613101b4c7995 (diff)
fw/instrument: Fix compatibility with Python2
The Python2 inspect module does not contain the `getfullargspec` method so call the appropriate method depending on Python version.
Diffstat (limited to 'wa/framework')
-rw-r--r--wa/framework/instrument.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/wa/framework/instrument.py b/wa/framework/instrument.py
index ced8c620..4611f86b 100644
--- a/wa/framework/instrument.py
+++ b/wa/framework/instrument.py
@@ -98,6 +98,7 @@ and the code to clear these file goes in teardown method. ::
"""
+import sys
import logging
import inspect
from collections import OrderedDict
@@ -324,7 +325,10 @@ def install(instrument, context):
if not callable(attr):
msg = 'Attribute {} not callable in {}.'
raise ValueError(msg.format(attr_name, instrument))
- argspec = inspect.getfullargspec(attr)
+ if sys.version_info[0] == 3:
+ argspec = inspect.getfullargspec(attr)
+ else:
+ argspec = inspect.getargspec(attr) # pylint: disable=deprecated-method
arg_num = len(argspec.args)
# Instrument callbacks will be passed exactly two arguments: self
# (the instrument instance to which the callback is bound) and