Skip to content

Commit

Permalink
Tracking change in type_caster_base.h on master (PR #3059).
Browse files Browse the repository at this point in the history
  • Loading branch information
Ralf W. Grosse-Kunstleve authored and rwgk committed Jun 26, 2021
1 parent 57a3663 commit 68b6f8c
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions include/pybind11/detail/smart_holder_type_casters.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,6 @@ class modified_type_caster_generic_load_impl {
PYBIND11_NOINLINE bool load_impl(handle src, bool convert) {
if (!src) return false;
if (!typeinfo) return try_load_foreign_module_local(src);
if (src.is_none()) {
// Defer accepting None to other overloads (if we aren't in convert mode):
if (!convert) return false;
loaded_v_h = value_and_holder();
return true;
}

auto &this_ = static_cast<ThisT &>(*this);

Expand Down Expand Up @@ -242,7 +236,17 @@ class modified_type_caster_generic_load_impl {
}

// Global typeinfo has precedence over foreign module_local
return try_load_foreign_module_local(src);
if (try_load_foreign_module_local(src))
return true;

if (src.is_none()) {
// Defer accepting None to other overloads (if we aren't in convert mode):
if (!convert) return false;
loaded_v_h = value_and_holder();
return true;
}

return false;
}

const type_info *typeinfo = nullptr;
Expand Down

0 comments on commit 68b6f8c

Please sign in to comment.