Skip to content

Commit 68b6f8c

Browse files
committed
Tracking change in type_caster_base.h on master (PR #3059).
1 parent 57a3663 commit 68b6f8c

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

include/pybind11/detail/smart_holder_type_casters.h

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,6 @@ class modified_type_caster_generic_load_impl {
164164
PYBIND11_NOINLINE bool load_impl(handle src, bool convert) {
165165
if (!src) return false;
166166
if (!typeinfo) return try_load_foreign_module_local(src);
167-
if (src.is_none()) {
168-
// Defer accepting None to other overloads (if we aren't in convert mode):
169-
if (!convert) return false;
170-
loaded_v_h = value_and_holder();
171-
return true;
172-
}
173167

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

@@ -242,7 +236,17 @@ class modified_type_caster_generic_load_impl {
242236
}
243237

244238
// Global typeinfo has precedence over foreign module_local
245-
return try_load_foreign_module_local(src);
239+
if (try_load_foreign_module_local(src))
240+
return true;
241+
242+
if (src.is_none()) {
243+
// Defer accepting None to other overloads (if we aren't in convert mode):
244+
if (!convert) return false;
245+
loaded_v_h = value_and_holder();
246+
return true;
247+
}
248+
249+
return false;
246250
}
247251

248252
const type_info *typeinfo = nullptr;

0 commit comments

Comments
 (0)