summaryrefslogtreecommitdiffstats
path: root/Lib/shlex.py
diff options
context:
space:
mode:
authorAlex <a.v.shkop@gmail.com>2019-09-11 11:04:04 (GMT)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2019-09-11 11:04:04 (GMT)
commit972cf5c06a5ba16ad243a442dbb9c15307fbed95 (patch)
treedd46b382dca4d0ad097442ba910e24f84b0755dd /Lib/shlex.py
parent6a9fd66f6e4445a418c43c92585b9e06d76df4b1 (diff)
downloadcpython-972cf5c06a5ba16ad243a442dbb9c15307fbed95.zip
cpython-972cf5c06a5ba16ad243a442dbb9c15307fbed95.tar.gz
cpython-972cf5c06a5ba16ad243a442dbb9c15307fbed95.tar.bz2
bpo-35168: Make shlex.punctuation_chars read-only (#11631)
* bpo-35168: Documentation about shlex.punctuation_chars now states that it should be set in __init__.py * bpo-35168: Convert shlex.punctuation_chars to read-only property * Add NEWS.d entry
Diffstat (limited to 'Lib/shlex.py')
-rw-r--r--Lib/shlex.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/shlex.py b/Lib/shlex.py
index edea077..ae0f5dd 100644
--- a/Lib/shlex.py
+++ b/Lib/shlex.py
@@ -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: