Skip to content

[BUG]: destructor crashes with latest merge of #5958 #5964

@lgritz

Description

@lgritz

Required prerequisites

What version (or hash if on master) of pybind11 are you using?

da6e071

Problem description

I haven't been able to track down the exact source of the bug, but my project's CI does one build variant against the top-of-tree pybind11 master, and has just started failing today.

I can confirm that it works for commit e44aae2, but fails for commit da6e071, which corresponds to the last merged PR, #5958.

In debug mode, I'm hitting assertions like:

/github/home/ext/dist/include/pybind11/detail/type_caster_base.h:380: pybind11::detail::values_and_holders::iterator::iterator(pybind11::detail::instance*, const type_vec*): Assertion `!types->empty()' failed.

Even in release modes (but with certain gcc hardening enabled), with gcc14 I'm getting

/usr/include/c++/14/bits/stl_vector.h:1149: constexpr std::vector< <template-parameter-1-1>, <template-parameter-1-2> >::const_reference std::vector< <template-parameter-1-1>, <template-parameter-1-2> >::operator[](size_type) const [with _Tp = pybind11::detail::type_info*; _Alloc = std::allocator<pybind11::detail::type_info*>; const_reference = pybind11::detail::type_info* const&; size_type = long unsigned int]: Assertion '__n < this->size()' failed.
Aborted (core dumped)

These tests all pass as late as yesterday, in the immediately previous pybind11 commit.

Reproducible example code


Is this a regression? Put the last known working version here if it is.

Not a regression

Metadata

Metadata

Assignees

No one assigned

    Labels

    triageNew bug, unverified

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions