This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ncoghlan
Recipients barry, emilyemorehouse, eric.smith, gvanrossum, joernheissler, koobs, miss-islington, ncoghlan, nedbat, pablogsal, rhettinger, serhiy.storchaka, steven.daprano, tim.peters, veky, willingc, xtreak
Date 2019-08-05.04:36:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1564979812.19.0.296945997043.issue35224@roundup.psfhosted.org>
In-reply-to
Content
Thanks Guido. The former test cases that the new PR removes are the following:

res = [i := i for i in range(5)]
res = [i := 0 for i, j in [(1, 2), (3, 4)]]
res = [(i := 0, j := 1) for i, j in [(1, 2), (3, 4)]]
res = [(i := i, j := j) for i, j in [(1, 2), (3, 4)]]
res = [(i := j, j := i) for i, j in [(1, 2), (3, 4)]]

These all raise TargetScopeError with the PR applied:

>>> res = [i := i for i in range(5)]
  File "<stdin>", line 1
TargetScopeError: named expression cannot rebind comprehension iteration variable
>>> res = [i := 0 for i, j in [(1, 2), (3, 4)]]
  File "<stdin>", line 1
TargetScopeError: named expression cannot rebind comprehension iteration variable
>>> res = [(i := 0, j := 1) for i, j in [(1, 2), (3, 4)]]
  File "<stdin>", line 1
TargetScopeError: named expression cannot rebind comprehension iteration variable
>>> res = [(i := i, j := j) for i, j in [(1, 2), (3, 4)]]
  File "<stdin>", line 1
TargetScopeError: named expression cannot rebind comprehension iteration variable
>>> res = [(i := j, j := i) for i, j in [(1, 2), (3, 4)]]
  File "<stdin>", line 1
TargetScopeError: named expression cannot rebind comprehension iteration variable
History
Date User Action Args
2019-08-05 04:36:52ncoghlansetrecipients: + ncoghlan, gvanrossum, tim.peters, barry, rhettinger, eric.smith, nedbat, steven.daprano, serhiy.storchaka, koobs, willingc, veky, emilyemorehouse, joernheissler, pablogsal, miss-islington, xtreak
2019-08-05 04:36:52ncoghlansetmessageid: <1564979812.19.0.296945997043.issue35224@roundup.psfhosted.org>
2019-08-05 04:36:52ncoghlanlinkissue35224 messages
2019-08-05 04:36:52ncoghlancreate