From ed7a3b11d9a6c21a964d55ebfcdefeb392389d10 Mon Sep 17 00:00:00 2001 From: Damien George Date: Tue, 23 May 2023 18:00:42 +1000 Subject: [PATCH] tools/pydfu.py: Use getattr to retrieve getargspec function. Since Python 3.11, inspect.getargspec() has been removed. Signed-off-by: Damien George --- tools/pydfu.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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