Skip to content

Commit 5bc3dd7

Browse files
committed
Addressing review comments.
1 parent a6250c6 commit 5bc3dd7

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

include/pybind11/cast.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ PYBIND11_NOINLINE inline handle get_type_handle(const std::type_info &tp, bool t
207207
return handle(type_info ? ((PyObject *) type_info->type) : nullptr);
208208
}
209209

210-
// Searches all_type_info for a registered instance, i.e. moving up the inheritance hierarchy.
210+
// Searches the inheritance graph for a registered Python instance, using all_type_info().
211211
PYBIND11_NOINLINE inline handle find_registered_python_instance(void *src,
212212
const detail::type_info *tinfo) {
213213
auto it_instances = get_internals().registered_instances.equal_range(src);
@@ -521,8 +521,7 @@ class type_caster_generic {
521521
if (src == nullptr)
522522
return none().release();
523523

524-
handle registered_inst = find_registered_python_instance(src, tinfo);
525-
if (registered_inst)
524+
if (handle registered_inst = find_registered_python_instance(src, tinfo))
526525
return registered_inst;
527526

528527
auto inst = reinterpret_steal<object>(make_new_instance(tinfo->type));

0 commit comments

Comments
 (0)