[proxy] github.com← back | site home | direct (HTTPS) ↗ | proxy home | ◑ dark◐ light

[3.8] bpo-37757: Disallow PEP 572 cases that expose implementation details by ncoghlan · Pull Request #15491 · python/cpython

ncoghlan

…ythonGH-15131)

- drop TargetScopeError in favour of raising SyntaxError directly
  as per the updated PEP 572
- comprehension iteration variables are explicitly local, but
  named expression targets in comprehensions are nonlocal or
  global. Raise SyntaxError as specified in PEP 572
- named expression targets in the outermost iterable of a
  comprehension have an ambiguous target scope. Avoid resolving
  that question now by raising SyntaxError. PEP 572
  originally required this only for cases where the bound name
  conflicts with the iteration variable in the comprehension,
  but CPython can't easily restrict the exception to that case
  (as it doesn't know the target variable names when visiting
  the outermost iterator expression)

(cherry picked from commit 5dbe0f5)

ncoghlan changed the title bpo-37757: Disallow PEP 572 cases that expose implementation details [3.8] bpo-37757: Disallow PEP 572 cases that expose implementation details

Aug 25, 2019

Merged