cpython: d8d6ec1333e6 (original) (raw)
Mercurial > cpython
changeset 100528:d8d6ec1333e6
Issue #26516: Fix test_capi on 32-bit system On 32-bit system, only 4 bytes after dumped for the tail. [#26516]
Victor Stinner victor.stinner@gmail.com | |
---|---|
date | Mon, 14 Mar 2016 17:40:09 +0100 |
parents | 3c3df33f2655 |
children | 9caf236cbe6d |
files | Lib/test/test_capi.py |
diffstat | 1 files changed, 9 insertions(+), 11 deletions(-)[+] [-] Lib/test/test_capi.py 20 |
line wrap: on
line diff
--- a/Lib/test/test_capi.py +++ b/Lib/test/test_capi.py @@ -4,6 +4,7 @@ import os import pickle import random +import re import subprocess import sys import sysconfig @@ -572,30 +573,27 @@ class MallocTests(unittest.TestCase): out = self.check('import _testcapi; _testcapi.pymem_buffer_overflow()') regex = (r"Debug memory block at address p={ptr}: API 'm'\n" r" 16 bytes originally requested\n"
r" The 7 pad bytes at p-7 are FORBIDDENBYTE, as expected.\n"[](#l1.15)
r" The 8 pad bytes at tail={ptr} are not all FORBIDDENBYTE \(0x[0-9a-f]{{2}}\):\n"[](#l1.16)
r" The [0-9] pad bytes at p-[0-9] are FORBIDDENBYTE, as expected.\n"[](#l1.17)
r" The [0-9] pad bytes at tail={ptr} are not all FORBIDDENBYTE \(0x[0-9a-f]{{2}}\):\n"[](#l1.18) r" at tail\+0: 0x78 \*\*\* OUCH\n"[](#l1.19) r" at tail\+1: 0xfb\n"[](#l1.20) r" at tail\+2: 0xfb\n"[](#l1.21)
r" at tail\+3: 0xfb\n"[](#l1.22)
r" at tail\+4: 0xfb\n"[](#l1.23)
r" at tail\+5: 0xfb\n"[](#l1.24)
r" at tail\+6: 0xfb\n"[](#l1.25)
r" at tail\+7: 0xfb\n"[](#l1.26)
r" .*\n"[](#l1.27) r" The block was made by call #[0-9]+ to debug malloc/realloc.\n"[](#l1.28)
r" Data at p: cb cb cb cb cb cb cb cb cb cb cb cb cb cb cb cb\n"[](#l1.29)
r" Data at p: cb cb cb .*\n"[](#l1.30) r"Fatal Python error: bad trailing pad byte")[](#l1.31) regex = regex.format(ptr=self.PTR_REGEX)[](#l1.32)
regex = re.compile(regex, flags=re.DOTALL)[](#l1.33) self.assertRegex(out, regex)[](#l1.34)
def test_api_misuse(self): out = self.check('import _testcapi; _testcapi.pymem_api_misuse()') regex = (r"Debug memory block at address p={ptr}: API 'm'\n" r" 16 bytes originally requested\n"
r" The 7 pad bytes at p-7 are FORBIDDENBYTE, as expected.\n"[](#l1.40)
r" The 8 pad bytes at tail={ptr} are FORBIDDENBYTE, as expected.\n"[](#l1.41)
r" The [0-9] pad bytes at p-[0-9] are FORBIDDENBYTE, as expected.\n"[](#l1.42)
r" The [0-9] pad bytes at tail={ptr} are FORBIDDENBYTE, as expected.\n"[](#l1.43) r" The block was made by call #[0-9]+ to debug malloc/realloc.\n"[](#l1.44)
r" Data at p: .*\n"[](#l1.45)
r" Data at p: cb cb cb .*\n"[](#l1.46) r"Fatal Python error: bad ID: Allocated using API 'm', verified using API 'r'\n")[](#l1.47) regex = regex.format(ptr=self.PTR_REGEX)[](#l1.48) self.assertRegex(out, regex)[](#l1.49)