]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-94808: Fix regex on exotic platforms (#98036)
authorJelle Zijlstra <jelle.zijlstra@gmail.com>
Fri, 7 Oct 2022 22:39:53 +0000 (15:39 -0700)
committerGitHub <noreply@github.com>
Fri, 7 Oct 2022 22:39:53 +0000 (15:39 -0700)
The test failed on a buildbot because the pointer was only 7 hex characters. To be safe,
I bumped it down to 3: 4 in case we have 32-bit platforms, and 3 in case the pointer is very small.

Lib/test/test_unicode.py
Makefile.pre.in

index b9ee9d30318c46e44cce5d7b41d9f85e30f8bf8b..5b816574f2c33541e26609a7e329d89ef45fca6a 100644 (file)
@@ -2811,7 +2811,7 @@ class CAPITest(unittest.TestCase):
         # We cannot test the exact result,
         # because it returns a hex representation of a C pointer,
         # which is going to be different each time. But, we can test the format.
-        p_format_regex = r'^0x[a-zA-Z0-9]{8,}$'
+        p_format_regex = r'^0x[a-zA-Z0-9]{3,}$'
         p_format1 = PyUnicode_FromFormat(b'%p', 'abc')
         self.assertIsInstance(p_format1, str)
         self.assertRegex(p_format1, p_format_regex)
@@ -2819,7 +2819,7 @@ class CAPITest(unittest.TestCase):
         p_format2 = PyUnicode_FromFormat(b'%p %p', '123456', b'xyz')
         self.assertIsInstance(p_format2, str)
         self.assertRegex(p_format2,
-                         r'0x[a-zA-Z0-9]{8,} 0x[a-zA-Z0-9]{8,}')
+                         r'0x[a-zA-Z0-9]{3,} 0x[a-zA-Z0-9]{3,}')
 
         # Extra args are ignored:
         p_format3 = PyUnicode_FromFormat(b'%p', '123456', None, b'xyz')
index 11118354f15defe427f645e1c7e03b74c9bf7c2d..4602db69d15af9c575b5e6d7e5a2de8ae65b0409 100644 (file)
@@ -2038,6 +2038,7 @@ TESTSUBDIRS=      distutils/tests \
                test/test_zoneinfo test/test_zoneinfo/data \
                test/test_unittest test/test_unittest/testmock \
                test/tracedmodules \
+               test/typinganndata \
                test/xmltestdata test/xmltestdata/c14n-20 \
                test/ziptestdata