Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

py2and3: Minor compatibility updates #10175

Conversation

EricCousineau-TRI
Copy link
Contributor

@EricCousineau-TRI EricCousineau-TRI commented Dec 10, 2018

Towards #8352.

This comes primarily from #9614 (with some minor whitespace change). If you'd like to test it with Python3, this README has instructions on how to do so with that branch:
https://github.com/EricCousineau-TRI/drake/blob/feature/py3-wip/py3.README.md


This change is Reviewable

Copy link
Contributor Author

@EricCousineau-TRI EricCousineau-TRI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+@sammy-tri for both reviews, please.

Reviewable status: all discussions resolved, platform LGTM missing

Copy link
Contributor

@sammy-tri sammy-tri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm: with one BTW. Did not test locally.

Reviewed 7 of 7 files at r1.
Reviewable status: :shipit: complete! all discussions resolved, platform LGTM from [sammy-tri]


bindings/pydrake/common/test/drake_variant_pybind_test.cc, line 39 at r1 (raw file):

  m.def("VariantToString", &VariantToString, py::arg("value"));
  py::globals().attr("update")(m.attr("__dict__"));

BTW this occurs in a few places and seems to have a strange smell to it and no comments beyond "For Python3". If I were writing a test here, I'm not sure I'd understand when this has to happen or not (but then again my pybind knowledge is not super great). Also it doesn't matter for this file since the resulting executable has only one test, but if there were multiple tests in the same file, would this leak into other tests? Or is py::globals() somehow more isolated than that? (apologies if I'm not understanding what's going on here.)

Copy link
Contributor

@sammy-tri sammy-tri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 7 of 7 files at r2.
Reviewable status: :shipit: complete! all discussions resolved, platform LGTM from [sammy-tri]

Copy link
Contributor Author

@EricCousineau-TRI EricCousineau-TRI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! all discussions resolved, platform LGTM from [sammy-tri]


bindings/pydrake/common/test/drake_variant_pybind_test.cc, line 39 at r1 (raw file):

Previously, sammy-tri (Sam Creasey) wrote…

BTW this occurs in a few places and seems to have a strange smell to it and no comments beyond "For Python3". If I were writing a test here, I'm not sure I'd understand when this has to happen or not (but then again my pybind knowledge is not super great). Also it doesn't matter for this file since the resulting executable has only one test, but if there were multiple tests in the same file, would this leak into other tests? Or is py::globals() somehow more isolated than that? (apologies if I'm not understanding what's going on here.)

OK Yeah, I don't really know... Made it a utility method to make the (anti)pattern more traceable, though.

Copy link
Contributor

@sammy-tri sammy-tri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 5 of 5 files at r3.
Reviewable status: :shipit: complete! all discussions resolved, platform LGTM from [sammy-tri]

Copy link
Contributor

@sammy-tri sammy-tri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r4.
Reviewable status: :shipit: complete! all discussions resolved, platform LGTM from [sammy-tri]

@EricCousineau-TRI EricCousineau-TRI merged commit 69fbe01 into RobotLocomotion:master Dec 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants