[New-bugs-announce] [issue16200] Setting .posix=True for shlex object causes infinite loop in __next__

Roger Serwy report at bugs.python.org
Thu Oct 11 21:09:30 CEST 2012


New submission from Roger Serwy:

The documentation for shlex does not prohibit the user from setting .posix=True after creating a shlex object. When doing so, the .eof attribute is inconsistent, creating an infinite loop in the __next__ method.

Here's some sample code to recreate the issue:

import shlex
s = shlex.shlex(r"", posix=False)
s.posix = True
list(s)

One possible solution is to make .posix a read-only property. Another is to make .posix a property which sets .eof correctly.

----------
components: Library (Lib)
messages: 172677
nosy: serwy
priority: normal
severity: normal
status: open
title: Setting .posix=True for shlex object causes infinite loop in __next__
type: behavior
versions: Python 2.7, Python 3.3, Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16200>
_______________________________________


More information about the New-bugs-announce mailing list