-
-
Notifications
You must be signed in to change notification settings - Fork 29.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PyNode_Compile() crashes in Python 3.8. #81253
Comments
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();
fp = fopen(filename, "r");
n = PyParser_SimpleParseFile(fp, filename, Py_file_input);
co = (PyObject *)PyNode_Compile(n, filename);
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 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. |
FWIW, this was occurring on macOS. Not been able to test on other platforms. |
Looks like this is caused by: https://github.com/python/cpython/pull/12086/files#diff-4d35cf8992b795c5e97e9c8b6167cb34R787 PyAST_FromNodeObject doesn't ignore flags any more, so when PyNode_Compile passes NULL flags, it crashes. (This is unfamiliar code for me; I won't have time to fix & test properly this week.) |
I mark this issue as a release blocker. |
OK, I'll look into this. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: