mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
If a code object is compiled with nested scopes, define the CO_NESTED flag.
Add PyEval_GetNestedScopes() which returns a non-zero value if the code for the current interpreter frame has CO_NESTED defined.
This commit is contained in:
parent
f6e47ad4bd
commit
061d106a0f
4 changed files with 13 additions and 1 deletions
|
@ -4276,6 +4276,8 @@ static int
|
|||
symtable_update_flags(struct compiling *c, PySymtableEntryObject *ste,
|
||||
struct symbol_info *si)
|
||||
{
|
||||
if (c->c_future && c->c_future->ff_nested_scopes)
|
||||
c->c_flags |= CO_NESTED;
|
||||
if (ste->ste_type != TYPE_MODULE)
|
||||
c->c_flags |= CO_NEWLOCALS;
|
||||
if (ste->ste_type == TYPE_FUNCTION) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue