Skip to content

Commit 192329e

Browse files
authored
Update Lib/shlex.py
1 parent bd6916a commit 192329e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Lib/shlex.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,8 @@ def quote(s):
326326
safe_chars = (b'%+,-./0123456789:=@'
327327
b'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'
328328
b'abcdefghijklmnopqrstuvwxyz')
329-
if not s.encode().translate(None, delete=safe_chars):
329+
# No quoting is needed if `s` is an ASCII string consisting only of `safe_chars`
330+
if s.isascii() and not s.encode().translate(None, delete=safe_chars):
330331
return s
331332

332333
# use single quotes, and put single quotes into double quotes

0 commit comments

Comments
 (0)