Skip to content

Commit 6f6f6ee

Browse files
committed
Only check this if we're in Python 2, otherwise types.InstanceType does not exist
1 parent ffbdca8 commit 6f6f6ee

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/compas_fab/backends/ros/service_description.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
import types
1212

13+
import compas
1314
from roslibpy import Service
1415
from roslibpy import ServiceRequest
1516

@@ -32,13 +33,14 @@ def __init__(self, name, service_type, request_class=None, response_class=None,
3233

3334
def call(self, client, request, callback, errback):
3435
def inner_handler(response_msg):
35-
# IronPython sometimes decides it's a good idea to use an old-style class
36-
# to pass the response_msg around, so we need to make sure we turn it into
37-
# a proper ServiceResponse again
38-
# https://github.com/compas-dev/compas_fab/issues/235
39-
is_old_style_class = isinstance(response_msg, types.InstanceType)
40-
if is_old_style_class:
41-
response_msg = dict(response_msg)
36+
if not compas.PY3:
37+
# IronPython sometimes decides it's a good idea to use an old-style class
38+
# to pass the response_msg around, so we need to make sure we turn it into
39+
# a proper ServiceResponse again
40+
# https://github.com/compas-dev/compas_fab/issues/235
41+
is_old_style_class = isinstance(response_msg, types.InstanceType)
42+
if is_old_style_class:
43+
response_msg = dict(response_msg)
4244
response_object = self.response_class.from_msg(response_msg)
4345

4446
# Validate the response if there's a validator function assigned

0 commit comments

Comments
 (0)