mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
bpo-33262: Deprecate passing None for s to shlex.split() (GH-6514)
* bpo-33262: Deprecate passing None for `s` to shlex.split() This reads the string to split from standard input. * Update What's New. * Fix shlex.rst
This commit is contained in:
parent
7c72383f95
commit
975ac326ff
5 changed files with 18 additions and 1 deletions
|
|
@ -304,6 +304,10 @@ class shlex:
|
|||
|
||||
def split(s, comments=False, posix=True):
|
||||
"""Split the string *s* using shell-like syntax."""
|
||||
if s is None:
|
||||
import warnings
|
||||
warnings.warn("Passing None for 's' to shlex.split() is deprecated.",
|
||||
DeprecationWarning, stacklevel=2)
|
||||
lex = shlex(s, posix=posix)
|
||||
lex.whitespace_split = True
|
||||
if not comments:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue