]> granicus.if.org Git - python/commitdiff
don't check that the first character is XID_Continue
authorBenjamin Peterson <benjamin@python.org>
Wed, 28 Sep 2011 12:09:05 +0000 (08:09 -0400)
committerBenjamin Peterson <benjamin@python.org>
Wed, 28 Sep 2011 12:09:05 +0000 (08:09 -0400)
Current, XID_Continue is a superset of XID_Start, but that may sometime change.

Lib/test/test_pep3131.py
Objects/unicodeobject.c

index df0f64d86aca72073131ceeae9acd2b519eab5a1..9a3c7eee158a9521e305031d6fb0e790807fa8dc 100644 (file)
@@ -19,10 +19,7 @@ class PEP3131Test(unittest.TestCase):
         𝔘𝔫𝔦𝔠𝔬𝔡𝔢 = 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:
index 2ae194723a2165f4f7d88af9ebb5a3766e941020..aff205d06597d7be77a739d811d4c405328dd526 100644 (file)
@@ -10196,7 +10196,7 @@ PyUnicode_IsIdentifier(PyObject *self)
     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;