[New-bugs-announce] [issue46302] IndexError inside list comprehension + workaround
report at bugs.python.org
Fri Jan 7 18:22:39 EST 2022
New submission from Pierre Fortin <pf at pfortin.com>:
var = "u2"
Works as expected, except that it returns IndexError (instead of "u") if used in a list comprehension -- at least, that's where I found it. Attached example script illustrates the issue.
Call it with "mytest N" where N is 1 (fails), 2 (works), 3 (fails).
mytest 1 -- KeyError expected; this was due to infile design change
adding a digit to previously single char code
mytest 2 -- workaround to actual issue in next test
mytest 3 -- adding  fails when used in list comprehension
components: Interpreter Core
title: IndexError inside list comprehension + workaround
versions: Python 3.8
Added file: https://bugs.python.org/file50548/mytest
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce