summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Doc/lib/libshlex.tex6
-rw-r--r--Lib/shlex.py4
-rw-r--r--Misc/NEWS2
3 files changed, 8 insertions, 4 deletions
diff --git a/Doc/lib/libshlex.tex b/Doc/lib/libshlex.tex
index 451615f..23babd3 100644
--- a/Doc/lib/libshlex.tex
+++ b/Doc/lib/libshlex.tex
@@ -19,13 +19,15 @@ files for Python applications) or for parsing quoted strings.
The \module{shlex} module defines the following functions:
-\begin{funcdesc}{split}{s\optional{, comments}}
+\begin{funcdesc}{split}{s\optional{, comments\optional{, posix}}}
Split the string \var{s} using shell-like syntax. If \var{comments} is
\constant{False} (the default), the parsing of comments in the given
string will be disabled (setting the \member{commenters} member of the
\class{shlex} instance to the empty string). This function operates
-in \POSIX{} mode.
+in \POSIX{} mode by default, but uses non-\POSIX{} mode if the
+\var{posix} argument is false.
\versionadded{2.3}
+\versionchanged[Added the \var{posix} parameter]{2.6}
\end{funcdesc}
The \module{shlex} module defines the following class:
diff --git a/Lib/shlex.py b/Lib/shlex.py
index 6632b87..fa18bb9 100644
--- a/Lib/shlex.py
+++ b/Lib/shlex.py
@@ -271,8 +271,8 @@ class shlex:
raise StopIteration
return token
-def split(s, comments=False):
- lex = shlex(s, posix=True)
+def split(s, comments=False, posix=True):
+ lex = shlex(s, posix)
lex.whitespace_split = True
if not comments:
lex.commenters = ''
diff --git a/Misc/NEWS b/Misc/NEWS
index 1b027f9..71cdeaf 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -217,6 +217,8 @@ Core and builtins
Library
-------
+- shlex.split() now has an optional "posix" parameter.
+
- The posixfile module now raises a DeprecationWarning.
- Remove the gopherlib module. This also leads to the removal of gopher