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

Detect and fail if using mismatched holders #2644

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixup! fixup! fixup! Replace global map holders_seen with local holde…
…r_type in registered type_info

Simplify code using type_id<Return>()
  • Loading branch information
rhaschke committed Nov 9, 2020
commit 8115384d038eb6fa9f71c4fa51fadf477d6b925d
4 changes: 1 addition & 3 deletions include/pybind11/pybind11.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,7 @@ class cpp_function : public function {
// Fail if the type was previously registered with a different holder type
if (!detail::check_for_holder_mismatch<Return>()) {
// If Return type was not yet registered, check_for_holder_mismatch() returns false w/o raising
std::string tname(typeid(Return).name());
detail::clean_type_id(tname);
pybind11_fail("Cannot register function with not yet registered return type \"" + tname + "\"");
pybind11_fail("Cannot register function with not yet registered return type \"" + type_id<Return>() + "\"");
}

/* Dispatch code which converts function arguments and performs the actual function call */
Expand Down