summaryrefslogtreecommitdiff
path: root/tools/pydfu.py
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2023-05-23 18:00:42 +1000
committerDamien George <damien@micropython.org>2023-05-24 12:00:32 +1000
commited7a3b11d9a6c21a964d55ebfcdefeb392389d10 (patch)
treeb185e1b62ddda43e85fcfb4d5811763bea2c254c /tools/pydfu.py
parent324d01eb527cc18c3696e2fa476f806dfe4a6527 (diff)
tools/pydfu.py: Use getattr to retrieve getargspec function.
Since Python 3.11, inspect.getargspec() has been removed. Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'tools/pydfu.py')
-rwxr-xr-xtools/pydfu.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/pydfu.py b/tools/pydfu.py
index 05cdf92c9..a9da3a0f8 100755
--- a/tools/pydfu.py
+++ b/tools/pydfu.py
@@ -77,7 +77,7 @@ __DFU_INTERFACE = 0
# Python 3 deprecated getargspec in favour of getfullargspec, but
# Python 2 doesn't have the latter, so detect which one to use
-getargspec = getattr(inspect, "getfullargspec", inspect.getargspec)
+getargspec = getattr(inspect, "getfullargspec", getattr(inspect, "getargspec", None))
if "length" in getargspec(usb.util.get_string).args:
# PyUSB 1.0.0.b1 has the length argument