Skip to content

Commit e04c69a

Browse files
committed
depending on the system getfullargspec might not be there
1 parent a924aa5 commit e04c69a

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

wolframclient/serializers/base.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@
1515
from wolframclient.utils.encoding import concatenate_bytes, force_text
1616
from wolframclient.utils.functional import first
1717

18+
if hasattr(inspect, 'getfullargspec'):
19+
inspect_args = inspect.getfullargspec
20+
elif hasattr(inspect, 'getargspec'):
21+
inspect_args = inspect.getargspec
22+
else:
23+
def inspect_args(f):
24+
raise TypeError()
25+
1826

1927
class FormatSerializer(Encoder):
2028
def generate_bytes(self, data):
@@ -139,7 +147,7 @@ def _serialize_external_object(self, o):
139147
yield "Type", "PythonFunction"
140148
try:
141149
# force tuple to avoid calling this method again on `map`.
142-
yield "Arguments", tuple(map(force_text, first(inspect.getargspec(o))))
150+
yield "Arguments", tuple(map(force_text, first(inspect_args(o))))
143151
except TypeError:
144152
# this function can fail with TypeError unsupported callable
145153
pass

0 commit comments

Comments
 (0)