[issue24796] Deleting names referencing from enclosed and enclosing scopes

2017-03-22 Thread Mariatta Wijaya

Mariatta Wijaya added the comment:

Thanks for the PR, Ivan. Merged and backported to 3.5 and 3.6.

--
nosy: +Mariatta
resolution:  -> fixed
stage: needs patch -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24796] Deleting names referencing from enclosed and enclosing scopes

2017-03-22 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
pull_requests: +681

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24796] Deleting names referencing from enclosed and enclosing scopes

2017-03-22 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
pull_requests: +680

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24796] Deleting names referencing from enclosed and enclosing scopes

2017-03-21 Thread Ivan Levkivskyi

Changes by Ivan Levkivskyi :


--
pull_requests: +667

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24796] Deleting names referencing from enclosed and enclosing scopes

2017-03-20 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
keywords: +easy
stage:  -> needs patch
versions: +Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24796] Deleting names referencing from enclosed and enclosing scopes

2017-03-18 Thread Ivan Levkivskyi

Ivan Levkivskyi added the comment:

It looks like it is safe to just remove this line from docs. This code

>>> x = 1
>>> def f():
... global x
... del x
... 
>>> f()
>>> x

Works as expected, i.e. raises NameError. (The same happens for nonlocal but 
with UnboundLocalError.)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24796] Deleting names referencing from enclosed and enclosing scopes

2015-08-05 Thread Nick Coghlan

New submission from Nick Coghlan:

While committing issue #24129, I noticed the following in the execution model 
documentation:

==
If a variable is referenced in an enclosing scope, it is illegal to delete the 
name. An error will be reported at compile time.
==

I'm not sure what that means, as both of the following compiled fine for me 
under 3.4.2:

 def f():
... x = 1
... def g():
... nonlocal x
... del x
... 
 def f():
... x = 1
... del x
... def g():
... print(x)
...

--
assignee: docs@python
components: Documentation
messages: 248036
nosy: docs@python, ncoghlan
priority: normal
severity: normal
status: open
title: Deleting names referencing from enclosed and enclosing scopes

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24796
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24796] Deleting names referencing from enclosed and enclosing scopes

2015-08-05 Thread Nick Coghlan

Nick Coghlan added the comment:

Note that I haven't attempted to resolve this myself, as I'm not sure if we 
should just delete the paragraph, or if we accidentally dropped a compile time 
error check that didn't have any tests somewhere along the line.

Probably a good one to raise on python-dev...

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24796
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24796] Deleting names referencing from enclosed and enclosing scopes

2015-08-05 Thread Steven D'Aprano

Steven D'Aprano added the comment:

I wonder if it is a left-over from the behaviour prior to 3.2? In 3.1, I
get this syntax error:

py def outer():
... spam = 1
... def inner():
... nonlocal spam
... del spam
... inner()
...
SyntaxError: can not delete variable 'spam' referenced in nested scope

See also the Changed in 3.2 comment here:

https://docs.python.org/3/reference/simple_stmts.html#the-del-statement

--
nosy: +steven.daprano

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24796
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24796] Deleting names referencing from enclosed and enclosing scopes

2015-08-05 Thread Ivan Levkivskyi

Changes by Ivan Levkivskyi levkivs...@gmail.com:


--
nosy: +levkivskyi

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24796
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com