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>
pull/9644/merge
Damien George 2023-05-23 18:00:42 +10:00
rodzic 324d01eb52
commit ed7a3b11d9
1 zmienionych plików z 1 dodań i 1 usunięć

Wyświetl plik

@ -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