[Python-checkins] cpython: don't check that the first character is XID_Continue

benjamin.peterson python-checkins at python.org
Wed Sep 28 14:09:11 CEST 2011


http://hg.python.org/cpython/rev/37932fd9433a
changeset:   72482:37932fd9433a
user:        Benjamin Peterson <benjamin at python.org>
date:        Wed Sep 28 08:09:05 2011 -0400
summary:
  don't check that the first character is XID_Continue

Current, XID_Continue is a superset of XID_Start, but that may sometime change.

files:
  Lib/test/test_pep3131.py |  5 +----
  Objects/unicodeobject.c  |  2 +-
  2 files changed, 2 insertions(+), 5 deletions(-)


diff --git a/Lib/test/test_pep3131.py b/Lib/test/test_pep3131.py
--- a/Lib/test/test_pep3131.py
+++ b/Lib/test/test_pep3131.py
@@ -19,10 +19,7 @@
         𝔘𝔫𝔦𝔠𝔬𝔡𝔢 = 1
         # On wide builds, this is normalized, but on narrow ones it is not. See
         # #12746.
-        try:
-            self.assertIn("𝔘𝔫𝔦𝔠𝔬𝔡𝔢", dir())
-        except AssertionError:
-            raise unittest.case._ExpectedFailure(sys.exc_info())
+        self.assertIn("Unicode", dir())
 
     def test_invalid(self):
         try:
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -10196,7 +10196,7 @@
     if (!_PyUnicode_IsXidStart(first) && first != 0x5F /* LOW LINE */)
         return 0;
 
-    for (i = 0; i < PyUnicode_GET_LENGTH(self); i++)
+    for (i = 1; i < PyUnicode_GET_LENGTH(self); i++)
         if (!_PyUnicode_IsXidContinue(PyUnicode_READ(kind, data, i)))
             return 0;
     return 1;

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list