Skip to content

Commit a54873d

Browse files
authored
Update shlex from 3.13.5 (#5977)
1 parent b965ce7 commit a54873d

File tree

2 files changed

+8
-15
lines changed

2 files changed

+8
-15
lines changed

Lib/shlex.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -305,9 +305,7 @@ def __next__(self):
305305
def split(s, comments=False, posix=True):
306306
"""Split the string *s* using shell-like syntax."""
307307
if s is None:
308-
import warnings
309-
warnings.warn("Passing None for 's' to shlex.split() is deprecated.",
310-
DeprecationWarning, stacklevel=2)
308+
raise ValueError("s argument must not be None")
311309
lex = shlex(s, posix=posix)
312310
lex.whitespace_split = True
313311
if not comments:
@@ -335,10 +333,7 @@ def quote(s):
335333

336334

337335
def _print_tokens(lexer):
338-
while 1:
339-
tt = lexer.get_token()
340-
if not tt:
341-
break
336+
while tt := lexer.get_token():
342337
print("Token: " + repr(tt))
343338

344339
if __name__ == '__main__':

Lib/test/test_shlex.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import shlex
44
import string
55
import unittest
6-
from unittest import mock
76

87

98
# The original test data set was from shellwords, by Hartmut Goebel.
@@ -162,18 +161,17 @@ def oldSplit(self, s):
162161
tok = lex.get_token()
163162
return ret
164163

165-
@mock.patch('sys.stdin', io.StringIO())
166-
def testSplitNoneDeprecation(self):
167-
with self.assertWarns(DeprecationWarning):
164+
def testSplitNone(self):
165+
with self.assertRaises(ValueError):
168166
shlex.split(None)
169167

170-
# TODO: RUSTPYTHON
168+
# TODO: RUSTPYTHON; ValueError: Error Retrieving Value
171169
@unittest.expectedFailure
172170
def testSplitPosix(self):
173171
"""Test data splitting with posix parser"""
174172
self.splitTest(self.posix_data, comments=True)
175173

176-
# TODO: RUSTPYTHON
174+
# TODO: RUSTPYTHON; ValueError: Error Retrieving Value
177175
@unittest.expectedFailure
178176
def testCompat(self):
179177
"""Test compatibility interface"""
@@ -315,7 +313,7 @@ def testEmptyStringHandling(self):
315313
s = shlex.shlex("'')abc", punctuation_chars=True)
316314
self.assertEqual(list(s), expected)
317315

318-
# TODO: RUSTPYTHON
316+
# TODO: RUSTPYTHON; ValueError: Error Retrieving Value
319317
@unittest.expectedFailure
320318
def testUnicodeHandling(self):
321319
"""Test punctuation_chars and whitespace_split handle unicode."""
@@ -356,7 +354,7 @@ def testJoin(self):
356354
joined = shlex.join(split_command)
357355
self.assertEqual(joined, command)
358356

359-
# TODO: RUSTPYTHON
357+
# TODO: RUSTPYTHON; ValueError: Error Retrieving Value
360358
@unittest.expectedFailure
361359
def testJoinRoundtrip(self):
362360
all_data = self.data + self.posix_data

0 commit comments

Comments
 (0)