From 745f5e2de709722e1586df597af59477cb3f6980 Mon Sep 17 00:00:00 2001 From: Thomas Heller Date: Thu, 12 Jul 2007 20:10:18 +0000 Subject: [PATCH] No crashes on Linux in the ctypes test suite any longer, so we can remove the 'crash-protection'. --- Lib/ctypes/test/test_functions.py | 18 ++++++++---------- Lib/ctypes/test/test_python_api.py | 22 ++++++++++------------ 2 files changed, 18 insertions(+), 22 deletions(-) diff --git a/Lib/ctypes/test/test_functions.py b/Lib/ctypes/test/test_functions.py index 0cca8619a3a..d7a3edf7d72 100644 --- a/Lib/ctypes/test/test_functions.py +++ b/Lib/ctypes/test/test_functions.py @@ -160,17 +160,15 @@ class FunctionTestCase(unittest.TestCase): result = f(1, 2, 3, 4, 5.0, 6.0, 21) self.failUnlessEqual(result, 42) - from ctypes.test import is_resource_enabled - if is_resource_enabled("struni-crash"): - def test_stringresult(self): - f = dll._testfunc_p_p - f.argtypes = None - f.restype = c_char_p - result = f(b"123") - self.failUnlessEqual(result, "123") + def test_stringresult(self): + f = dll._testfunc_p_p + f.argtypes = None + f.restype = c_char_p + 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): f = dll._testfunc_p_p diff --git a/Lib/ctypes/test/test_python_api.py b/Lib/ctypes/test/test_python_api.py index 8348c8b66fd..f701d54f01d 100644 --- a/Lib/ctypes/test/test_python_api.py +++ b/Lib/ctypes/test/test_python_api.py @@ -67,21 +67,19 @@ class PythonAPITestCase(unittest.TestCase): del pyobj self.failUnlessEqual(grc(s), ref) - from ctypes.test import is_resource_enabled - if is_resource_enabled("struni-crash"): - def test_PyOS_snprintf(self): - PyOS_snprintf = pythonapi.PyOS_snprintf - PyOS_snprintf.argtypes = POINTER(c_char), c_size_t, c_char_p + def test_PyOS_snprintf(self): + PyOS_snprintf = pythonapi.PyOS_snprintf + PyOS_snprintf.argtypes = POINTER(c_char), c_size_t, c_char_p - buf = c_buffer(256) - PyOS_snprintf(buf, sizeof(buf), "Hello from %s", b"ctypes") - self.failUnlessEqual(buf.value, "Hello from ctypes") + buf = c_buffer(256) + PyOS_snprintf(buf, sizeof(buf), "Hello from %s", b"ctypes") + self.failUnlessEqual(buf.value, "Hello from ctypes") - 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)") + 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)") - # not enough arguments - self.failUnlessRaises(TypeError, PyOS_snprintf, buf) + # not enough arguments + self.failUnlessRaises(TypeError, PyOS_snprintf, buf) def test_pyobject_repr(self): self.failUnlessEqual(repr(py_object()), "py_object()")