You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[cppyy] Only alias size() to __len__ for container-like classes
Guard the automatic size() -> __len__ pythonization to require that
size() returns an integer type and the class has begin()/end() methods
or operator[]. This prevents bool() returning False for valid objects
whose size() returns non-integer types like std::optional<std::size_t>.
Use Cppyy::IsIntegerType (backed by Clang's QualType) to check the
return type, which correctly resolves typedefs like size_type. Walk the
MRO when checking for size/begin/end/getitem attributes, since
HasAttrDirect only checks the class's own __dict__. Skip pythonization
if size() has multiple overloads.
Update tests for stl_like_class2/3 which have incomplete container
interfaces (missing iterators or returning non-iterator types from
begin/end).
0 commit comments