-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Open
Labels
triageNew bug, unverifiedNew bug, unverified
Description
Required prerequisites
- Make sure you've read the documentation. Your issue may be addressed there.
- Search the issue tracker and Discussions to verify that this hasn't already been reported. +1 or comment there if it has.
- Consider asking first in the Gitter chat room or in a Discussion.
What version (or hash if on master) of pybind11 are you using?
Problem description
Importing this and then exiting Python causes a crash at
pybind11/include/pybind11/pybind11.h
Line 824 in 4f81a12
| std::free(const_cast<char *>(arg.name)); |
arg.name is "self", and it appears to be a string literal instead of a malloced string.
Said literal is assigned to it at
pybind11/include/pybind11/attr.h
Line 494 in 4f81a12
| r->args.emplace_back("self", nullptr, handle(), /*convert=*/true, /*none=*/false); |
Editing that function to
malloc the string seems to fix the crash.
I've bisected this, the offending commit is 1b7aa0b
I'm not sure if it matters, but I'm on CPython 3.10 on Ubuntu 22.04.
Reproducible example code
#include <pybind11/pybind11.h>
enum E {};
PYBIND11_MODULE(example, m)
{
pybind11::enum_<E> e(m, "E");
}
Is this a regression? Put the last known working version here if it is.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
triageNew bug, unverifiedNew bug, unverified