aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
authorLars Amsel <lars.amsel@ni.com>2021-06-15 15:05:34 +0200
committerAaron Rossetto <aaron.rossetto@ni.com>2021-06-23 13:57:15 -0500
commit067411a35264bd8f5645dc7585dcea8027bfa3bc (patch)
tree8a6694ede0240558f447b1f003e67e93fb0cc0d5 /host
parent9281d34fd16dd32bb61ce995da6b9a691c9718bd (diff)
downloaduhd-067411a35264bd8f5645dc7585dcea8027bfa3bc.tar.gz
uhd-067411a35264bd8f5645dc7585dcea8027bfa3bc.tar.bz2
uhd-067411a35264bd8f5645dc7585dcea8027bfa3bc.zip
cal: Remove silent capture of TypeError
Remove the silent capture of TypeError because it would also catch TypeErrors is initilization errors in class creation. Instead check obj to be a class first to ensure issubclass wont throw a TypeError.
Diffstat (limited to 'host')
-rw-r--r--host/python/uhd/usrp/cal/usrp_calibrator.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/host/python/uhd/usrp/cal/usrp_calibrator.py b/host/python/uhd/usrp/cal/usrp_calibrator.py
index a665564ba..f409072d4 100644
--- a/host/python/uhd/usrp/cal/usrp_calibrator.py
+++ b/host/python/uhd/usrp/cal/usrp_calibrator.py
@@ -411,11 +411,9 @@ def get_usrp_calibrator(usrp, meas_dev, direction, **kwargs):
raise RuntimeError("Could not determine USRP type!")
print("=== Detected USRP type:", usrp_type)
for _, obj in inspect.getmembers(sys.modules[__name__]):
- try:
- if issubclass(obj, USRPCalibratorBase) \
- and usrp_type in getattr(obj, 'mboard_ids', ''):
- return obj(usrp, meas_dev, direction, **kwargs)
- except TypeError:
- continue
+ if (inspect.isclass(obj) and
+ issubclass(obj, USRPCalibratorBase) and
+ usrp_type in getattr(obj, 'mboard_ids', '')):
+ return obj(usrp, meas_dev, direction, **kwargs)
raise RuntimeError("No USRP calibrator object found for device type: {}"
.format(usrp_type))