From: Robert Bradshaw Date: Tue, 11 May 2010 04:18:46 +0000 (-0700) Subject: String literal identifiers ending in newlines. X-Git-Tag: 0.13.beta0~94 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c0e9631fa135cb8aa7d677990d50a1f1b747dd97;p=cython.git String literal identifiers ending in newlines. --- diff --git a/Cython/Compiler/Code.py b/Cython/Compiler/Code.py index 323d2c79..bc20ec4a 100644 --- a/Cython/Compiler/Code.py +++ b/Cython/Compiler/Code.py @@ -289,7 +289,7 @@ class PyObjectConst(object): possible_unicode_identifier = re.compile(ur"(?![0-9])\w+$", re.U).match possible_bytes_identifier = re.compile(r"(?![0-9])\w+$".encode('ASCII')).match -nice_identifier = re.compile('^[a-zA-Z0-9_]+$').match +nice_identifier = re.compile(r'\A[a-zA-Z0-9_]+\Z').match find_alphanums = re.compile('([a-zA-Z0-9]+)').findall class StringConst(object): diff --git a/tests/run/strliterals.pyx b/tests/run/strliterals.pyx index 68719f4c..1a344ac1 100644 --- a/tests/run/strliterals.pyx +++ b/tests/run/strliterals.pyx @@ -103,6 +103,9 @@ __doc__ = ur""" True >>> len(u6) 7 + + >>> newlines == "Aaa\n" + True """ import sys @@ -127,3 +130,5 @@ u3 = ur"abc\x11" u4 = Ur"abc\x11" u5 = uR"abc\x11" u6 = UR"abc\x11" + +newlines = "Aaa\n"