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

DM-15126: Make meas_* compatible with pybind11 2.2 (as well as 2.1) #123

Merged
merged 3 commits into from Jul 17, 2018

Conversation

r-owen
Copy link
Contributor

@r-owen r-owen commented Jul 16, 2018

No description provided.

@r-owen r-owen changed the title DM-15126: Make meas_base compatible with pybind11 2.2 (as well as 2.1) DM-15126: Make meas_* compatible with pybind11 2.2 (as well as 2.1) Jul 16, 2018
Copy link
Member

@kfindeisen kfindeisen left a comment

Choose a reason for hiding this comment

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

The code itself is fine, but I don't understand the motivation for expanding anonymous namespaces to include everything. Can you explain where that came from?

@@ -48,8 +47,6 @@ PYBIND11_PLUGIN(algorithm) {
mod, "SimpleAlgorithm", py::multiple_inheritance());

/* Members */
python::declareAlgorithm<SingleFrameAlgorithm>(clsSingleFrameAlgorithm);

Copy link
Member

Choose a reason for hiding this comment

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

If we can no longer call declareAlgorithm on an abstract class (and the inability to wrap abstract methods seems like a step backwards 😞), consider removing abstract class support from declareAlgorithm.

Based on discussion with @r-owen it seems the real problem is not that SingleFrameAlgorithm is abstract, but that BaseAlgorithm is a virtual base of SingleFrameAlgorithm. However, the pybind11 docs don't say anything forbidding the wrapping of classes with virtual bases. I suggest not modifying declareAlgorithm until we know for sure whether the new behavior is intentional or a bug.

@@ -31,6 +31,7 @@ using namespace pybind11::literals;
namespace lsst {
namespace meas {
namespace base {
namespace {

PYBIND11_PLUGIN(algorithm) {
Copy link
Member

Choose a reason for hiding this comment

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

This is different from the examples in the style guide. Are we now required to put PYBIND11_PLUGIN in an anonymous namespace? I can't find any mention of anonymous namespaces in the pybind11 docs...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm quite surprised. I thought our standard called for putting everything in anonymous namespace -- it's certainly easier that way, as then one can add functions as needed without worrying about it. But I have redone my changes to follow the style guide.

@r-owen r-owen force-pushed the tickets/DM-15126 branch 2 times, most recently from 68e89e1 to f5d62e1 Compare July 17, 2018 00:26
Standardize the use of anonymous namespace in our pybind11 wrappers
and run clang-format on our wrappers
which defines it, instead of subclass SingleFrameAlgorithm,
which does not.
Also rearrange the declarations for clarity.
@r-owen
Copy link
Contributor Author

r-owen commented Jul 17, 2018

@kfindeisen based on your comments on slack I found and fixed the underlying error in algorithms.cc. This allowed the wrapper to work as before, eliminating the need to change the other two meas_* packages. I will drop those two ticket branches.

@r-owen r-owen merged commit 95fb7bf into master Jul 17, 2018
@ktlim ktlim deleted the tickets/DM-15126 branch August 25, 2018 06:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants