• Nick Coghlan's avatar
    bpo-37757: Disallow PEP 572 cases that expose implementation details (GH-15131) · 5dbe0f59
    Nick Coghlan authored
    - 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)
    5dbe0f59
2019-08-05-14-22-59.bpo-37757.lRv5HX.rst 334 Bytes