diff --git a/Lib/test/test_cmd_line.py b/Lib/test/test_cmd_line.py index 57508c7..f23b254 100644 --- a/Lib/test/test_cmd_line.py +++ b/Lib/test/test_cmd_line.py @@ -7,6 +7,7 @@ import os import sys import subprocess import tempfile +import time from test.script_helper import spawn_python, kill_python, assert_python_ok, assert_python_failure @@ -259,6 +260,28 @@ class CmdLineTest(unittest.TestCase): "print(repr(input()))", b"'abc'") + def test_unmatched_quote(self): + # See http://bugs.python.org/issue10206 + + # Use a single unmatched quote as input + p = spawn_python('-c', "'") + + try: + # Let it run for at most 20 sec + for i in range(20): + if p.poll(): + break + time.sleep(1) + else: + p.terminate() + p.wait() + raise AssertionError('Timeout') + finally: + p.stdin.close() + p.stdout.close() + + self.assertNotEqual(p.returncode, 0) + def test_main(): test.support.run_unittest(CmdLineTest)