This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author tphh
Recipients tphh
Date 2018-11-05.17:32:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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/", line 295, in __next__
    token = self.get_token()
  File "/opt/python/3.7.1/lib/python3.7/", line 105, in get_token
    raw = self.read_token()
  File "/opt/python/3.7.1/lib/python3.7/", line 133, in read_token
    if self.punctuation_chars and self._pushback_chars:
AttributeError: 'shlex' object has no attribute '_pushback_chars'
Date User Action Args
2018-11-05 17:32:14tphhsetrecipients: + tphh
2018-11-05 17:32:14tphhsetmessageid: <>
2018-11-05 17:32:14tphhlinkissue35168 messages
2018-11-05 17:32:13tphhcreate