mirror of
https://github.com/python/cpython.git
synced 2025-07-29 06:05:00 +00:00
account for PyObject_IsInstance's new ability to fail
This commit is contained in:
parent
c169c781a8
commit
5f429e0227
3 changed files with 464 additions and 90 deletions
|
@ -466,6 +466,7 @@ builtin_compile(PyObject *self, PyObject *args, PyObject *kwds)
|
|||
int mode = -1;
|
||||
int dont_inherit = 0;
|
||||
int supplied_flags = 0;
|
||||
int is_ast;
|
||||
PyCompilerFlags cf;
|
||||
PyObject *result = NULL, *cmd, *tmp = NULL;
|
||||
Py_ssize_t length;
|
||||
|
@ -505,7 +506,10 @@ builtin_compile(PyObject *self, PyObject *args, PyObject *kwds)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (PyAST_Check(cmd)) {
|
||||
is_ast = PyAST_Check(cmd);
|
||||
if (is_ast == -1)
|
||||
return NULL;
|
||||
if (is_ast) {
|
||||
if (supplied_flags & PyCF_ONLY_AST) {
|
||||
Py_INCREF(cmd);
|
||||
result = cmd;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue