Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"with ... as ..." exit scope namespace pollution and gc locking #10

Open
pmp-p opened this issue Aug 10, 2020 · 0 comments
Open

"with ... as ..." exit scope namespace pollution and gc locking #10

pmp-p opened this issue Aug 10, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@pmp-p
Copy link
Owner

pmp-p commented Aug 10, 2020

"with" blocks when using "as" should not pollute locals() on exit, the "as" keyword should be considered as the const() keyword from MicroPython, and not assignable in the scope.
ideally :

with something as temp1, another as temp2:
    pass

should be executed as :

with something as temp, another as temp2:
    temp1 = something # <= should raise an error like temp1 would as a const(something)
   
    # should raise a warning of a potential conflict with a gc optimized context ( maybe decorator on `__exit__` ? )
    x = temp2 

del temp1, temp2; gc.collect()

That's a bit that except: blocks are doing on cpython ( even if they should not do it exactly as they do actually (3.8) )

@pmp-p pmp-p added the enhancement New feature or request label Aug 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant