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

Conversation

timj
Copy link
Member

@timj timj commented Apr 2, 2019

lsst.pex.exceptions.TypeError no longer inherits from RuntimeError.

timj added 2 commits April 2, 2019 11:20
Inherit from LogicError not RuntimeError. Some things can become
confused if pex.exceptions.TypeError inherits from builtins.TypeError
and builtins.RuntimeError.
@timj timj requested a review from ktlim April 2, 2019 18:22
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 timj merged commit 8de6c91 into master Apr 3, 2019
@timj timj deleted the tickets/DM-18855 branch April 3, 2019 00:03
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.

None yet

1 participant