[New-bugs-announce] [issue41982] Wrong location flagged as syntax error

iljah report at bugs.python.org
Fri Oct 9 09:43:54 EDT 2020


New submission from iljah <ilja.honkonen at protonmail.ch>:

File:
#! /usr/bin/env python3
with \
  open('file1', 'w') as file1,
  open('file2', 'w') as file2:

  print('ok')

gives error:
  File "./test.py", line 3
    open('file1', 'w') as file1,
                         ^
SyntaxError: invalid syntax

but adding \ after file1 fixes it:
  open('file1', 'w') as file1, \


Location flagged by syntax error (between as and file1) is not correct.

----------
components: Interpreter Core
messages: 378321
nosy: iljah
priority: normal
severity: normal
status: open
title: Wrong location flagged as syntax error
type: behavior
versions: Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41982>
_______________________________________


More information about the New-bugs-announce mailing list