RobotLocomotion / drake

Model-based design and verification for robotics.
https://drake.mit.edu
Other
3.35k stars 1.27k forks source link

pydrake: Should handle deprecation of implicit conversions to `_int__` #14936

Open EricCousineau-TRI opened 3 years ago

EricCousineau-TRI commented 3 years ago

From @RussTedrake on Slack: https://drakedevelopers.slack.com/archives/C3YB3EV5W/p1619088373041800

Today I encountered

DeprecationWarning: an integer is required (got type pydrake.systems.framework.InputPortIndex).  Implicit conversion to integers using __int__ is deprecated, and may be removed in a future version of Python.
return LinearQuadraticRegulator(plant, context,`

... the LQR method indeed takes an int for (possible) use as an input port index. Of course I can do the cast here, but is this a widespread pattern that we need to fix?

I'm not sure where this arises (CPython / Python, or pybind11), but once we identify it, two possible solutions may just be:

Russ - I assume this was encountered in CPython 3.7 via Google Colab?

RussTedrake commented 3 years ago

actually it was python3.9 on mac.