summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2012-03-07 20:50:25 (GMT)
committerBenjamin Peterson <benjamin@python.org>2012-03-07 20:50:25 (GMT)
commite48944b69c5c720a9ae5631daa4dbf27e8369371 (patch)
tree9636e80fbb8cd60b66490a18be47b584c386c3ae /Lib/test
parent30b8e5461d4d913365ae4151616089107ec9cfac (diff)
downloadcpython-e48944b69c5c720a9ae5631daa4dbf27e8369371.zip
cpython-e48944b69c5c720a9ae5631daa4dbf27e8369371.tar.gz
cpython-e48944b69c5c720a9ae5631daa4dbf27e8369371.tar.bz2
keep the buffer object around while we're using it (closes #14212)
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_re.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py
index 0f39ead..4e18531 100644
--- a/Lib/test/test_re.py
+++ b/Lib/test/test_re.py
@@ -1,4 +1,5 @@
-from test.support import verbose, run_unittest
+from test.support import verbose, run_unittest, gc_collect
+import io
import re
from re import Scanner
import sys
@@ -16,6 +17,17 @@ import unittest
class ReTests(unittest.TestCase):
+ def test_keep_buffer(self):
+ # See bug 14212
+ b = bytearray(b'x')
+ it = re.finditer(b'a', b)
+ with self.assertRaises(BufferError):
+ b.extend(b'x'*400)
+ list(it)
+ del it
+ gc_collect()
+ b.extend(b'x'*400)
+
def test_weakref(self):
s = 'QabbbcR'
x = re.compile('ab+c')