From 788bd5af30ecee5c54b1039171b77765c3f340a8 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Thu, 1 Jun 2017 14:17:36 -0700 Subject: py3k: only pass str instances to shlex --- alot/helper.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'alot/helper.py') diff --git a/alot/helper.py b/alot/helper.py index 0297ea65..bd84e287 100644 --- a/alot/helper.py +++ b/alot/helper.py @@ -40,7 +40,6 @@ def split_commandline(s, comments=False, posix=True): s = s.replace('\\', '\\\\') s = s.replace('\'', '\\\'') s = s.replace('\"', '\\\"') - # encode s to utf-8 for shlex lex = shlex.shlex(s, posix=posix) lex.whitespace_split = True lex.whitespace = ';' @@ -55,8 +54,7 @@ def split_commandstring(cmdstring): and the like. This simply calls shlex.split but works also with unicode bytestrings. """ - if isinstance(cmdstring, str): - cmdstring = cmdstring.encode('utf-8', errors='ignore') + assert isinstance(cmdstring, str) return shlex.split(cmdstring) -- cgit v1.2.3