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-18855: Fix Python TypeError inheritance to match C++ #23

Merged
merged 3 commits into from
Apr 3, 2019

Commits on Apr 2, 2019

  1. Change Python pex_exceptions TypeError to match C++ inheritance

    Inherit from LogicError not RuntimeError. Some things can become
    confused if pex.exceptions.TypeError inherits from builtins.TypeError
    and builtins.RuntimeError.
    timj committed Apr 2, 2019
    Configuration menu
    Copy the full SHA
    7b1f6bd View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    7a7793e View commit details
    Browse the repository at this point in the history
  3. Ensure that the return type matches the type returned

    Without this change modern clang warns. The reason in this case
    as that there is a mismatch between the item being returned
    and the declared return type of the function.
    
    In file included from tests/testLib.cc:30:
    include/lsst/pex/exceptions/python/Exception.h:98:12: warning: local variable 'cls' will be copied despite being returned by name [-Wreturn-std-move]
        return cls;
               ^~~
    tests/testLib.cc:58:24: note: in instantiation of function template specialization 'lsst::pex::exceptions::python::declareException<TestError, lsst::pex::exceptions::Exception>' requested here
        auto cls = python::declareException<TestError>(mod, "TestError", "RuntimeError");
                           ^
    include/lsst/pex/exceptions/python/Exception.h:98:12: note: call 'std::move' explicitly to avoid copying
        return cls;
               ^~~
               std::move(cls)
    1 warning generated.
    timj committed Apr 2, 2019
    Configuration menu
    Copy the full SHA
    c3d8804 View commit details
    Browse the repository at this point in the history