This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author acue
Recipients Andrey.Kislyuk, acue, cvrebert, eric.araujo, eric.smith, ezio.melotti, python-dev, r.david.murray, robodan, vinay.sajip
Date 2016-10-09.08:02:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1476000165.64.0.597524292198.issue28392@psf.upfronthosting.co.za>
In-reply-to
Content
See also 28391: Multiple occurances of: Closing quotes separate words

The issue 28391 is accepted, as it is defined:
 Quotes *within* words are ignored, only a leading quoted string will result in a separate word.  (That's recursive: try '"Do""This""Separate).

So I implement for compatibility mode your proposal.

But the example does not seem to work as expected, so seems to hint to a bug. Thus openning a seperate issue:

snip-->
import shlex

sopts = """-a "Do""This""Separate" """
resx = ["-a", '"Do"', 'ThisSeparate', ]
res=shlex.split(sopts,posix=False)

print "sopts  ="+str(sopts)
print "resx   ="+str(resx)
print "res    ="+str(res)
assert res == resx 

"""
Results in:

sopts  =-a "Do""This""Separate" 
resx   =['-a', '"Do"', 'ThisSeparate']
res    =['-a', '"Do"', '"This"', '"Separate"']
Traceback (most recent call last):
  File "shlex_demo.py", line 52, in <module>
    assert res == resx 
AssertionError

"""

<--snip

I also checked the variant with a trailing quoted word for completeness, which is not enclosed. Does not split at all:

sopts  =-a Do"SeparateThis" 
resx   =['-a', 'Do', '"SeparateThis"']
res    =['-a', 'Do"SeparateThis"']
History
Date User Action Args
2016-10-09 08:02:45acuesetrecipients: + acue, vinay.sajip, eric.smith, robodan, ezio.melotti, eric.araujo, r.david.murray, cvrebert, python-dev, Andrey.Kislyuk
2016-10-09 08:02:45acuesetmessageid: <1476000165.64.0.597524292198.issue28392@psf.upfronthosting.co.za>
2016-10-09 08:02:45acuelinkissue28392 messages
2016-10-09 08:02:45acuecreate