mirror of
https://github.com/python/cpython.git
synced 2025-08-10 11:58:39 +00:00
[3.8] bpo-35168: Make shlex.punctuation_chars read-only (GH-11631) (GH-15927)
(cherry picked from commit 972cf5c06a
)
Co-authored-by: Alex <a.v.shkop@gmail.com>
This commit is contained in:
parent
01ae0e2698
commit
3b92ddb761
4 changed files with 18 additions and 4 deletions
|
@ -55,7 +55,7 @@ class shlex:
|
|||
punctuation_chars = ''
|
||||
elif punctuation_chars is True:
|
||||
punctuation_chars = '();<>|&'
|
||||
self.punctuation_chars = punctuation_chars
|
||||
self._punctuation_chars = punctuation_chars
|
||||
if punctuation_chars:
|
||||
# _pushback_chars is a push back queue used by lookahead logic
|
||||
self._pushback_chars = deque()
|
||||
|
@ -65,6 +65,10 @@ class shlex:
|
|||
t = self.wordchars.maketrans(dict.fromkeys(punctuation_chars))
|
||||
self.wordchars = self.wordchars.translate(t)
|
||||
|
||||
@property
|
||||
def punctuation_chars(self):
|
||||
return self._punctuation_chars
|
||||
|
||||
def push_token(self, tok):
|
||||
"Push a token onto the stack popped by the get_token method"
|
||||
if self.debug >= 1:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue