mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
[3.13] gh-130070: Fix exec(<string>, closure=<non-None>)
unexpected path (GH-130071) (#132627)
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>
(cherry picked from commit 954b2cf031
)
This commit is contained in:
parent
db7ad1c89f
commit
582d1ef463
3 changed files with 18 additions and 0 deletions
|
@ -1154,6 +1154,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