Skip to content

pybind11: Should ensure that python3.8-dbg doesn't cause segfault on Linux? #14740

Closed
RobotLocomotion/pybind11
#52
@EricCousineau-TRI

Description

@EricCousineau-TRI

When doing RobotLocomotion/pybind11#47, I realized that both that PR and the current version of RobotLocomotion/pybind11 segfaults in CPython 3.8.0 debug build on Linux. (Surprised we didn't see it with Mac, but oh well... could be due to it being older 3.8.0)

The following code fails on our newest version of the fork, but not on upstream.

cd pybind11
sudo apt install python3.8-dev python3.8-venv python3.8-dbg

do-build() { (
set -eux;
python_bin=${1}
mode=${2}

git clean -fxd  # WARNING!
${python_bin} -m venv ./venv
source ./venv/bin/activate
pip install -U pip wheel
pip install pytest numpy
mkdir build && cd build
cmake .. -GNinja \
    -DCMAKE_BUILD_TYPE=${mode} \
    -DPYTHON_EXECUTABLE=$(which python)
ninja pytest
) }

# Release
do-build python3.8 Release
# Debug
do-build python3.8-dbg Debug

Segfault info:

python: ../Objects/typeobject.c:3121: _PyType_Lookup: Assertion `!PyErr_Occurred()' failed.
Aborted (core dumped)

Upstream:

Fork:

Note that the above PR (47) makes things pass in non-debug mode, but still fails otherwise.

Should check w/ later CPython 3.8.x versions too.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions