Index: Lib/shlex.py =================================================================== --- Lib/shlex.py (revision 83187) +++ Lib/shlex.py (working copy) @@ -32,11 +32,6 @@ else: self.eof = '' self.commenters = '#' - self.wordchars = ('abcdfeghijklmnopqrstuvwxyz' - 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_') - if self.posix: - self.wordchars += ('ßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ' - 'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ') self.whitespace = ' \t\r\n' self.whitespace_split = False self.quotes = '\'"' @@ -53,6 +48,12 @@ print('shlex: reading from %s, line %d' \ % (self.instream, self.lineno)) + def iswordchar(self, ch): + result = ch.isalnum() or ch == '_' + if not self.posix: + result = result and ord(ch) < 128 + return result + def push_token(self, tok): "Push a token onto the stack popped by the get_token method" if self.debug >= 1: @@ -144,7 +145,7 @@ elif self.posix and nextchar in self.escape: escapedstate = 'a' self.state = nextchar - elif nextchar in self.wordchars: + elif self.iswordchar(nextchar): self.token = nextchar self.state = 'a' elif nextchar in self.quotes: @@ -219,8 +220,8 @@ elif self.posix and nextchar in self.escape: escapedstate = 'a' self.state = nextchar - elif nextchar in self.wordchars or nextchar in self.quotes \ - or self.whitespace_split: + elif (self.iswordchar(nextchar) or nextchar in self.quotes + or self.whitespace_split): self.token = self.token + nextchar else: self.pushback.appendleft(nextchar)