Commit c90bc759 authored by Georg Brandl's avatar Georg Brandl

shlex.split() now has an optional "posix" parameter.

parent df25efea
...@@ -19,13 +19,15 @@ files for Python applications) or for parsing quoted strings. ...@@ -19,13 +19,15 @@ files for Python applications) or for parsing quoted strings.
The \module{shlex} module defines the following functions: 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 Split the string \var{s} using shell-like syntax. If \var{comments} is
\constant{False} (the default), the parsing of comments in the given \constant{False} (the default), the parsing of comments in the given
string will be disabled (setting the \member{commenters} member of the string will be disabled (setting the \member{commenters} member of the
\class{shlex} instance to the empty string). This function operates \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} \versionadded{2.3}
\versionchanged[Added the \var{posix} parameter]{2.6}
\end{funcdesc} \end{funcdesc}
The \module{shlex} module defines the following class: The \module{shlex} module defines the following class:
......
...@@ -271,8 +271,8 @@ class shlex: ...@@ -271,8 +271,8 @@ class shlex:
raise StopIteration raise StopIteration
return token return token
def split(s, comments=False): def split(s, comments=False, posix=True):
lex = shlex(s, posix=True) lex = shlex(s, posix)
lex.whitespace_split = True lex.whitespace_split = True
if not comments: if not comments:
lex.commenters = '' lex.commenters = ''
......
...@@ -217,6 +217,8 @@ Core and builtins ...@@ -217,6 +217,8 @@ Core and builtins
Library Library
------- -------
- shlex.split() now has an optional "posix" parameter.
- The posixfile module now raises a DeprecationWarning. - The posixfile module now raises a DeprecationWarning.
- Remove the gopherlib module. This also leads to the removal of gopher - Remove the gopherlib module. This also leads to the removal of gopher
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment