Skip to content

Commit 8f87bc9

Browse files
committed
[skip ci] Add st.first comments (generated by ChatGPT)
1 parent 00257be commit 8f87bc9

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

include/pybind11/detail/type_caster_base.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,8 @@ handle smart_holder_from_unique_ptr(std::unique_ptr<T, D> &&src,
576576
if (!src) {
577577
return none().release();
578578
}
579+
// st.first is the subobject pointer appropriate for tinfo (may differ from src.get()
580+
// under MI/VI). Use this for Python identity/registration, but keep ownership on T*.
579581
void *src_raw_void_ptr = const_cast<void *>(st.first);
580582
assert(st.second != nullptr);
581583
const detail::type_info *tinfo = st.second;
@@ -657,6 +659,8 @@ handle smart_holder_from_shared_ptr(const std::shared_ptr<T> &src,
657659
return none().release();
658660
}
659661

662+
// st.first is the subobject pointer appropriate for tinfo (may differ from src.get()
663+
// under MI/VI). Use this for Python identity/registration, but keep ownership on T*.
660664
void *src_raw_void_ptr = const_cast<void *>(st.first);
661665
assert(st.second != nullptr);
662666
const detail::type_info *tinfo = st.second;

0 commit comments

Comments
 (0)