From c0e9631fa135cb8aa7d677990d50a1f1b747dd97 Mon Sep 17 00:00:00 2001 From: Robert Bradshaw Date: Mon, 10 May 2010 21:18:46 -0700 Subject: [PATCH] String literal identifiers ending in newlines. --- Cython/Compiler/Code.py | 2 +- tests/run/strliterals.pyx | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) 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" -- 2.26.2