summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorStefan Krah <skrah@bytereef.org>2012-08-20 09:04:24 (GMT)
committerStefan Krah <skrah@bytereef.org>2012-08-20 09:04:24 (GMT)
commitfd24f9e51e80fb050e4239f6909eaff2d29ec30d (patch)
tree0b9630a2ee3f5252c781ca9fef9207578dbbd43e /Lib/test
parente56bf97ef4283a877c459390516bb7385e8e4ec4 (diff)
downloadcpython-fd24f9e51e80fb050e4239f6909eaff2d29ec30d.zip
cpython-fd24f9e51e80fb050e4239f6909eaff2d29ec30d.tar.gz
cpython-fd24f9e51e80fb050e4239f6909eaff2d29ec30d.tar.bz2
Issue #15732: Fix (constructed) crash in _PySequence_BytesToCharpArray().
Found by Coverity.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_capi.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_capi.py b/Lib/test/test_capi.py
index c2c633f..0307394 100644
--- a/Lib/test/test_capi.py
+++ b/Lib/test/test_capi.py
@@ -11,6 +11,10 @@ import time
import unittest
from test import support
try:
+ import _posixsubprocess
+except ImportError:
+ _posixsubprocess = None
+try:
import threading
except ImportError:
threading = None
@@ -55,6 +59,15 @@ class CAPITest(unittest.TestCase):
def test_memoryview_from_NULL_pointer(self):
self.assertRaises(ValueError, _testcapi.make_memoryview_from_NULL_pointer)
+ @unittest.skipUnless(_posixsubprocess, '_posixsubprocess required for this test.')
+ def test_seq_bytes_to_charp_array(self):
+ # Issue #15732: crash in _PySequence_BytesToCharpArray()
+ class Z(object):
+ def __len__(self):
+ return 1
+ self.assertRaises(TypeError, _posixsubprocess.fork_exec,
+ 1,Z(),3,[1, 2],5,6,7,8,9,10,11,12,13,14,15,16,17)
+
@unittest.skipUnless(threading, 'Threading required for this test.')
class TestPendingCalls(unittest.TestCase):