[New-bugs-announce] [issue46302] IndexError inside list comprehension + workaround
Pierre Fortin
report at bugs.python.org
Fri Jan 7 18:22:39 EST 2022
New submission from Pierre Fortin <pf at pfortin.com>:
var = "u2"
var.strip()[0]
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 [0] fails when used in list comprehension
----------
components: Interpreter Core
files: mytest
messages: 410054
nosy: NetAlien
priority: normal
severity: normal
status: open
title: IndexError inside list comprehension + workaround
type: behavior
versions: Python 3.8
Added file: https://bugs.python.org/file50548/mytest
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46302>
_______________________________________
More information about the New-bugs-announce
mailing list