diff options
author | Jelle Zijlstra <jelle.zijlstra@gmail.com> | 2022-10-07 22:39:53 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-07 22:39:53 (GMT) |
commit | a54a69989eade3589459d15def53b3c4f21b7551 (patch) | |
tree | 6fa2b522c5d0ed7c6766cfbdc22cc5ec3dbca8d4 | |
parent | cb4615fd43e678fe44e9aeb6a486475a05b492e7 (diff) | |
download | cpython-a54a69989eade3589459d15def53b3c4f21b7551.zip cpython-a54a69989eade3589459d15def53b3c4f21b7551.tar.gz cpython-a54a69989eade3589459d15def53b3c4f21b7551.tar.bz2 |
gh-94808: Fix regex on exotic platforms (#98036)
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.
-rw-r--r-- | Lib/test/test_unicode.py | 4 | ||||
-rw-r--r-- | Makefile.pre.in | 1 |
2 files changed, 3 insertions, 2 deletions
diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py index b9ee9d3..5b81657 100644 --- a/Lib/test/test_unicode.py +++ b/Lib/test/test_unicode.py @@ -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') diff --git a/Makefile.pre.in b/Makefile.pre.in index 1111835..4602db6 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -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 |