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:
Zackery Spytz 2020-04-01 07:58:55 -06:00 committed by GitHub
parent 7c72383f95
commit 975ac326ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 1 deletions

View file

@ -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: