Mercurial > ~astiob > upreckon > hgweb
diff upreckon/testcases.py @ 232:f94f9724c543
Switched from str to bytes for external validator output
author | Oleg Oshmyan <chortos@inbox.lv> |
---|---|
date | Fri, 29 Jun 2012 03:32:49 +0300 |
parents | 65b5c9390010 |
children |
line wrap: on
line diff
--- a/upreckon/testcases.py Wed Jun 06 20:41:44 2012 +0100 +++ b/upreckon/testcases.py Fri Jun 29 03:32:49 2012 +0300 @@ -1,4 +1,4 @@ -# Copyright (c) 2010-2011 Chortos-2 <chortos@inbox.lv> +# Copyright (c) 2010-2012 Chortos-2 <chortos@inbox.lv> # TODO: copy the ansfile if not options.erase even if no validator is used @@ -227,12 +227,12 @@ case.open_outfile() case.outfile.copy(case.problem.config.ansname) try: - case.process = Popen(case.validator, stdin=devnull, stdout=PIPE, stderr=STDOUT, universal_newlines=True, bufsize=-1) + case.process = Popen(case.validator, stdin=devnull, stdout=PIPE, stderr=STDOUT, bufsize=-1) except OSError: raise CannotStartValidator(sys.exc_info()[1]) with signal_ignorer: comment = case.process.communicate()[0].strip() - match = re.match(r'(?i)(?:ok|(?:(?:in)?correct|wrong)(?:(?:\s|_)*answer)?)(?:$|\s+|[.,!:]+\s*)', comment) + match = re.match(r'(?i)(?:ok|(?:(?:in)?correct|wrong)(?:(?:\s|_)*answer)?)(?:$|\s+|[.,!:]+\s*)'.encode('ascii'), comment) if match: comment = comment[match.end():] if not case.problem.config.maxexitcode: