New submission from tphh <thomas.o...@pdv-fs.de>:
The newly added shlex.punctuation_chars is special compared to the other public instance variables: It can ONLY be used when constructing a shlex instance, unlike other public instance variables, such as commenters, which can ONLY be set later. >>> s = shlex.shlex('abc // def') >>> s.commenters = '/' >>> list(s) ['abc', '', ''] >>> s = shlex.shlex('abc // def', punctuation_chars = '/') >>> list(s) ['abc', '//', 'def'] However, setting punctuation_chars later shows this rather useless error message: >>> s = shlex.shlex('abc // def') >>> s.punctuation_chars = '/' >>> list(s) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/opt/python/3.7.1/lib/python3.7/shlex.py", line 295, in __next__ token = self.get_token() File "/opt/python/3.7.1/lib/python3.7/shlex.py", line 105, in get_token raw = self.read_token() File "/opt/python/3.7.1/lib/python3.7/shlex.py", line 133, in read_token if self.punctuation_chars and self._pushback_chars: AttributeError: 'shlex' object has no attribute '_pushback_chars' ---------- components: Library (Lib) messages: 329310 nosy: tphh priority: normal severity: normal status: open title: shlex punctuation_chars inconsistency type: behavior versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue35168> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com