This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author YannickJadoul
Recipients YannickJadoul
Date 2021-01-10.13:00:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Issue detected in the embedding tests of pybind11, running on the latest alpha of 3.10:

I have reduced the weird issue/crash to a minimal reproducer, which consistently reproduces the crash on my Linux machine:

#include <Python.h>

int main() {


    PyRun_SimpleString("class Widget: pass\n"
                       "class DerivedWidget(Widget):\n"
                       "    def __init__(self):\n"
                       "        super().__init__()\n");



    return 0;

Removing the two lines in the middle that restart the interpreter makes the example work.

I've also bisected CPython to find the issue (3.10.0a3 is fine, 3.10.0a4 is not), and arrived at (ba3d67c2fb04a7842741b1b6da5d67f22c579f33 being the first commit that breaks the example above). But I am not entirely sure where to start debugging.

The reproducing example above consistently crashes on my local machine (SIGABRT, exit code 134):

Fatal Python error: compiler_make_closure: lookup '__class__' in DerivedWidget 5 -1
freevars of __init__: ('__class__',)

Python runtime state: initialized

Current thread 0x00007f036485b680 (most recent call first):
<no Python frame>
Aborted (core dumped)

But note that in the pybind11 tests, the underlying issue causes a different error (Python throwing a weird, seemingly unrelated exception). So something seems to be messed up in the interpreter internals, and the above example just triggers it.
Date User Action Args
2021-01-10 13:00:18YannickJadoulsetrecipients: + YannickJadoul
2021-01-10 13:00:18YannickJadoulsetmessageid: <>
2021-01-10 13:00:18YannickJadoullinkissue42882 messages
2021-01-10 13:00:18YannickJadoulcreate