Skip to content

Commit 997f475

Browse files
committed
Changed defer checks to use explicit is True.
Using `if defer is True:` for checks instead of `if defer:` catches a lot of weird errors that can occur if the positional args to any of the reflected planning-method functions are shifted by one. The previous check would return a Future if an extra argument got passed, which concealed exceptions indicating that the arguments made no sense, and would be passed to subsequent code until something actually tried to query a Trajectory method on the Future.
1 parent fcdad6e commit 997f475

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/prpy/base/robot.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ def do_postprocess():
300300

301301
return CopyTrajectory(traj, env=self.GetEnv())
302302

303-
if defer:
303+
if defer is True:
304304
from trollius.executor import get_default_executor
305305
from trollius.futures import wrap_future
306306

@@ -333,7 +333,7 @@ def do_execute():
333333
logger.debug('Executing timed trajectory.')
334334
return self.ExecuteTrajectory(traj, defer=False, **kwargs)
335335

336-
if defer:
336+
if defer is True:
337337
from trollius.executor import get_default_executor
338338
from trollius.futures import wrap_future
339339

@@ -399,7 +399,7 @@ def ExecuteTrajectory(self, traj, defer=False, timeout=None, period=0.01):
399399
'Trajectory includes the base, but no base controller is'
400400
' available. Is self.base.controller set?')
401401

402-
if defer:
402+
if defer is True:
403403
import time
404404
import trollius
405405

0 commit comments

Comments
 (0)