Issue #15732: Fix (constructed) crash in _PySequence_BytesToCharpArray().

Found by Coverity.
This commit is contained in:
Stefan Krah 2012-08-20 11:04:24 +02:00
parent e56bf97ef4
commit fd24f9e51e
2 changed files with 18 additions and 0 deletions

View file

@ -10,6 +10,10 @@ import sys
import time
import unittest
from test import support
try:
import _posixsubprocess
except ImportError:
_posixsubprocess = None
try:
import threading
except ImportError:
@ -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):