[issue1134] Parsing a simple script eats all of your memory

Christian Heimes report at bugs.python.org
Wed Nov 14 04:14:25 CET 2007


Christian Heimes added the comment:

I've already raised the priority to draw more attention to this bug.

So far I'm not able to solve the bug but I've nailed down the issue to a
short test case:

HANGS:
# -*- coding: ascii -*-
"""
"""

The problem manifests itself only in the combination of the ascii
encoding and triple quotes across two or more line. Neither a different
encoding nor a string across a single line has the same problem

WORKS:
# -*- coding: ascii -*-
""" """

WORKS:
# -*- coding: latin.1 -*-
"""
"""

WORKS:
# -*- coding: ascii -*-
""" """

DOESN'T COMPILE:
# -*- coding: ascii -*-
"\
"
File "hungry_script2.py", line 5
SyntaxError: EOL while scanning single-quoted string

The latest example does compile with Python 2.5. Please note also the
wrong line number. The file has only three (!) lines.

During my debugging session I saw an infinite loop in tokenzize.c:1429

  letter_quote:
	/* String */
	if (c == '\'' || c == '"') {
		...
		for (;;) {
			INFINITE LOOP
		}

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1134>
__________________________________


More information about the Python-bugs-list mailing list