Mercurial > cpython-lru_cache-weakref
comparison Python/bltinmodule.c @ 57673:20b7deb53d4e legacy-trunk
account for PyObject_IsInstance's new ability to fail
| author | Benjamin Peterson <benjamin@python.org> |
|---|---|
| date | Sun, 13 Dec 2009 00:54:15 +0000 |
| parents | 75e1b8c05f43 |
| children | f550ed89398f |
comparison
equal
deleted
inserted
replaced
| 57665:2ffd19a224d4 | 57673:20b7deb53d4e |
|---|---|
| 464 char *filename; | 464 char *filename; |
| 465 char *startstr; | 465 char *startstr; |
| 466 int mode = -1; | 466 int mode = -1; |
| 467 int dont_inherit = 0; | 467 int dont_inherit = 0; |
| 468 int supplied_flags = 0; | 468 int supplied_flags = 0; |
| 469 int is_ast; | |
| 469 PyCompilerFlags cf; | 470 PyCompilerFlags cf; |
| 470 PyObject *result = NULL, *cmd, *tmp = NULL; | 471 PyObject *result = NULL, *cmd, *tmp = NULL; |
| 471 Py_ssize_t length; | 472 Py_ssize_t length; |
| 472 static char *kwlist[] = {"source", "filename", "mode", "flags", | 473 static char *kwlist[] = {"source", "filename", "mode", "flags", |
| 473 "dont_inherit", NULL}; | 474 "dont_inherit", NULL}; |
| 503 PyErr_SetString(PyExc_ValueError, | 504 PyErr_SetString(PyExc_ValueError, |
| 504 "compile() arg 3 must be 'exec', 'eval' or 'single'"); | 505 "compile() arg 3 must be 'exec', 'eval' or 'single'"); |
| 505 return NULL; | 506 return NULL; |
| 506 } | 507 } |
| 507 | 508 |
| 508 if (PyAST_Check(cmd)) { | 509 is_ast = PyAST_Check(cmd); |
| 510 if (is_ast == -1) | |
| 511 return NULL; | |
| 512 if (is_ast) { | |
| 509 if (supplied_flags & PyCF_ONLY_AST) { | 513 if (supplied_flags & PyCF_ONLY_AST) { |
| 510 Py_INCREF(cmd); | 514 Py_INCREF(cmd); |
| 511 result = cmd; | 515 result = cmd; |
| 512 } | 516 } |
| 513 else { | 517 else { |
