Mercurial > p > roundup > code
comparison roundup/token.py @ 5245:bc16d91b7a50
Fix token_split() so its one error throws ValueError w/out extra arg.
In Python 3, raise has to throw a single object value without extra
arguments. This commit also checked the function's callsites. One
needed armoring, didn't have it, and got it. There didn't seem to be
anything to do about the other than add a warning comment.
All tests pass.
| author | Eric S. Raymond <esr@thyrsus.com> |
|---|---|
| date | Thu, 24 Aug 2017 17:27:49 -0400 |
| parents | 6e3e4f24c753 |
| children | 0942fe89e82e |
comparison
equal
deleted
inserted
replaced
| 5244:09235a01250a | 5245:bc16d91b7a50 |
|---|---|
| 52 finish = 0 | 52 finish = 0 |
| 53 token = '' | 53 token = '' |
| 54 while 1: | 54 while 1: |
| 55 # end of string, finish off the current token | 55 # end of string, finish off the current token |
| 56 if pos == length: | 56 if pos == length: |
| 57 if state == QUOTE: raise ValueError, "unmatched quote" | 57 if state == QUOTE: raise ValueError |
| 58 elif state == TOKEN: l.append(token) | 58 elif state == TOKEN: l.append(token) |
| 59 break | 59 break |
| 60 c = s[pos] | 60 c = s[pos] |
| 61 if state == NEWTOKEN: | 61 if state == NEWTOKEN: |
| 62 # looking for a new token | 62 # looking for a new token |
