New submission from Trey Hunner <[email protected]>:
The below code worked on Python 3.5, 3.6, 3.7, and 3.8, but it now crashes on
Python 3.9.
from contextlib import contextmanager
@contextmanager
def open_files(names):
yield names # This would actually return file objects
with open_files(['file1.txt', 'file2.txt']) as (first, *rest):
print(first, rest)
The error shown is:
with open_files(['file1.txt', 'file2.txt']) as (first, *rest):
^
SyntaxError: invalid syntax
----------
messages: 380932
nosy: trey
priority: normal
severity: normal
status: open
title: Tuple unpacking with * causes SyntaxError in with ... as ...
type: behavior
versions: Python 3.9
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue42354>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com