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>
This commit is contained in:
Damien George 2023-05-23 18:00:42 +10:00
parent 324d01eb52
commit ed7a3b11d9
1 changed files with 1 additions and 1 deletions

View File

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