mirror of
https://github.com/python/cpython.git
synced 2025-08-31 22:18:28 +00:00
gh-130070: Fix exec(<string>, closure=<non-None>)
unexpected path (#130071)
Fixed an assertion error (so, it could be reproduced only in builds with assertions enabled) for `exec` when the `source` argument is a string and the `closure` argument is not `None`. Co-authored-by: sobolevn <mail@sobolevn.me>
This commit is contained in:
parent
d7df7815f5
commit
954b2cf031
3 changed files with 18 additions and 0 deletions
|
@ -1169,6 +1169,7 @@ builtin_exec_impl(PyObject *module, PyObject *source, PyObject *globals,
|
|||
if (closure != NULL) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"closure can only be used when source is a code object");
|
||||
goto error;
|
||||
}
|
||||
PyObject *source_copy;
|
||||
const char *str;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue