mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
Merge 3.2.
This commit is contained in:
commit
6adf2433e4
2 changed files with 18 additions and 0 deletions
|
|
@ -10,6 +10,10 @@ import sys
|
||||||
import time
|
import time
|
||||||
import unittest
|
import unittest
|
||||||
from test import support
|
from test import support
|
||||||
|
try:
|
||||||
|
import _posixsubprocess
|
||||||
|
except ImportError:
|
||||||
|
_posixsubprocess = None
|
||||||
try:
|
try:
|
||||||
import threading
|
import threading
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
|
@ -78,6 +82,15 @@ class CAPITest(unittest.TestCase):
|
||||||
else:
|
else:
|
||||||
self.assertTrue(False)
|
self.assertTrue(False)
|
||||||
|
|
||||||
|
@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.')
|
@unittest.skipUnless(threading, 'Threading required for this test.')
|
||||||
class TestPendingCalls(unittest.TestCase):
|
class TestPendingCalls(unittest.TestCase):
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2718,6 +2718,11 @@ _PySequence_BytesToCharpArray(PyObject* self)
|
||||||
for (i = 0; i < argc; ++i) {
|
for (i = 0; i < argc; ++i) {
|
||||||
char *data;
|
char *data;
|
||||||
item = PySequence_GetItem(self, i);
|
item = PySequence_GetItem(self, i);
|
||||||
|
if (item == NULL) {
|
||||||
|
/* NULL terminate before freeing. */
|
||||||
|
array[i] = NULL;
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
data = PyBytes_AsString(item);
|
data = PyBytes_AsString(item);
|
||||||
if (data == NULL) {
|
if (data == NULL) {
|
||||||
/* NULL terminate before freeing. */
|
/* NULL terminate before freeing. */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue