Skip to content

locals() dict share actual local variable #1356

Closed
@HyeockJinKim

Description

@HyeockJinKim

Feature

def a(d):
    locals()['d'] = 3
    b = 3 + d
    print(b)

a(21)

The code above generates the following error:
(locals dict share actual local variable)

Actual Result

Finished dev [unoptimized + debuginfo] target(s) in 0.11s
Running `target/debug/rustpython c.py`
6

Expected Result

24

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-compatA discrepancy between RustPython and CPython

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions