Skip to content

Commit bfd074d

Browse files
authored
Fix use of depricated inspect.getargspec()
Fixes: #76
1 parent 9951378 commit bfd074d

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

umodbus/functions.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,15 @@
5757
"""
5858
from __future__ import division
5959
import struct
60-
import inspect
6160
import math
61+
62+
try:
63+
from inspect import getfullargspec
64+
except ImportError:
65+
# inspect.getfullargspec was introduced in Python 3.4.
66+
# Earlier versions have inspect.getargspec.
67+
from inspect import getargspec as getfullargspec
68+
6269
try:
6370
from functools import reduce
6471
except ImportError:
@@ -126,7 +133,7 @@ def create_function_from_response_pdu(resp_pdu, req_pdu=None):
126133
function = function_code_to_function_map[function_code]
127134

128135
if req_pdu is not None and \
129-
'req_pdu' in inspect.getargspec(function.create_from_response_pdu).args: # NOQA
136+
'req_pdu' in getfullargspec(function.create_from_response_pdu).args: # NOQA
130137

131138
return function.create_from_response_pdu(resp_pdu, req_pdu)
132139

0 commit comments

Comments
 (0)