[New-bugs-announce] [issue37072] PyNode_Compile() crashes in Python 3.8.

Graham Dumpleton report at bugs.python.org
Mon May 27 21:52:54 EDT 2019


New submission from Graham Dumpleton <Graham.Dumpleton at gmail.com>:

The code:

#include <Python.h>

int
main(int argc, char *argv[])
{
    FILE *fp = NULL;
    PyObject *co = NULL;
    struct _node *n = NULL;
    const char * filename = "/dev/null";

    Py_Initialize();

    fprintf(stderr, "START\n");

    fp = fopen(filename, "r");

    fprintf(stderr, "CALL PyParser_SimpleParseFile()\n");

    n = PyParser_SimpleParseFile(fp, filename, Py_file_input);

    fprintf(stderr, "CALL PyNode_Compile()\n");

    co = (PyObject *)PyNode_Compile(n, filename);

    fprintf(stderr, "DONE\n");

    Py_Finalize();

    return 0;
}

has worked fine since Python 2.3 (and maybe earlier) through Python 3.7, but now crashes in Python 3.8.

It crashes in PyNode_Compile().

START
CALL PyParser_SimpleParseFile()
CALL PyNode_Compile()
Segmentation fault: 11

Although it is part of the public interface of compile.h, the PyNode_Compile() seems never to actually be called anywhere in Python itself, and perhaps isn't even covered by tests. So if Python 3.8 internal changes mean this function implementation needs to be changed, that fact may have been missed.

----------
messages: 343727
nosy: grahamd
priority: normal
severity: normal
status: open
title: PyNode_Compile() crashes in Python 3.8.
versions: Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37072>
_______________________________________


More information about the New-bugs-announce mailing list