##// END OF EJS Templates
Backport a bugfix from trunk; works around Python bug 1170....
Fernando Perez -
Show More
@@ -287,13 +287,12 b' def arg_split(s,posix=False):'
287 function, but with a default of posix=False for splitting, so that quotes
287 function, but with a default of posix=False for splitting, so that quotes
288 in inputs are respected."""
288 in inputs are respected."""
289
289
290 # XXX - there may be unicode-related problems here!!! I'm not sure that
290 # Unfortunately, python's shlex module is buggy with unicode input:
291 # shlex is truly unicode-safe, so it might be necessary to do
291 # http://bugs.python.org/issue1170
292 #
292 # At least encoding the input when it's unicode seems to help, but there
293 # s = s.encode(sys.stdin.encoding)
293 # may be more problems lurking. Apparently this is fixed in python3.
294 #
294 if isinstance(s, unicode):
295 # first, to ensure that shlex gets a normal string. Input from anyone who
295 s = s.encode(sys.stdin.encoding)
296 # knows more about unicode and shlex than I would be good to have here...
297 lex = shlex.shlex(s, posix=posix)
296 lex = shlex.shlex(s, posix=posix)
298 lex.whitespace_split = True
297 lex.whitespace_split = True
299 return list(lex)
298 return list(lex)
General Comments 0
You need to be logged in to leave comments. Login now