Commit 745f5e2d authored by Thomas Heller's avatar Thomas Heller

No crashes on Linux in the ctypes test suite any longer, so we can

remove the 'crash-protection'.
parent f4f771fe
...@@ -160,17 +160,15 @@ class FunctionTestCase(unittest.TestCase): ...@@ -160,17 +160,15 @@ class FunctionTestCase(unittest.TestCase):
result = f(1, 2, 3, 4, 5.0, 6.0, 21) result = f(1, 2, 3, 4, 5.0, 6.0, 21)
self.failUnlessEqual(result, 42) self.failUnlessEqual(result, 42)
from ctypes.test import is_resource_enabled def test_stringresult(self):
if is_resource_enabled("struni-crash"): f = dll._testfunc_p_p
def test_stringresult(self): f.argtypes = None
f = dll._testfunc_p_p f.restype = c_char_p
f.argtypes = None result = f(b"123")
f.restype = c_char_p self.failUnlessEqual(result, "123")
result = f(b"123")
self.failUnlessEqual(result, "123") result = f(None)
self.failUnlessEqual(result, None)
result = f(None)
self.failUnlessEqual(result, None)
def test_pointers(self): def test_pointers(self):
f = dll._testfunc_p_p f = dll._testfunc_p_p
......
...@@ -67,21 +67,19 @@ class PythonAPITestCase(unittest.TestCase): ...@@ -67,21 +67,19 @@ class PythonAPITestCase(unittest.TestCase):
del pyobj del pyobj
self.failUnlessEqual(grc(s), ref) self.failUnlessEqual(grc(s), ref)
from ctypes.test import is_resource_enabled def test_PyOS_snprintf(self):
if is_resource_enabled("struni-crash"): PyOS_snprintf = pythonapi.PyOS_snprintf
def test_PyOS_snprintf(self): PyOS_snprintf.argtypes = POINTER(c_char), c_size_t, c_char_p
PyOS_snprintf = pythonapi.PyOS_snprintf
PyOS_snprintf.argtypes = POINTER(c_char), c_size_t, c_char_p
buf = c_buffer(256) buf = c_buffer(256)
PyOS_snprintf(buf, sizeof(buf), "Hello from %s", b"ctypes") PyOS_snprintf(buf, sizeof(buf), "Hello from %s", b"ctypes")
self.failUnlessEqual(buf.value, "Hello from ctypes") self.failUnlessEqual(buf.value, "Hello from ctypes")
PyOS_snprintf(buf, sizeof(buf), "Hello from %s (%d, %d, %d)", b"ctypes", 1, 2, 3) PyOS_snprintf(buf, sizeof(buf), "Hello from %s (%d, %d, %d)", b"ctypes", 1, 2, 3)
self.failUnlessEqual(buf.value, "Hello from ctypes (1, 2, 3)") self.failUnlessEqual(buf.value, "Hello from ctypes (1, 2, 3)")
# not enough arguments # not enough arguments
self.failUnlessRaises(TypeError, PyOS_snprintf, buf) self.failUnlessRaises(TypeError, PyOS_snprintf, buf)
def test_pyobject_repr(self): def test_pyobject_repr(self):
self.failUnlessEqual(repr(py_object()), "py_object(<NULL>)") self.failUnlessEqual(repr(py_object()), "py_object(<NULL>)")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment