Revert rev. 59926, it breaks comtypes (I need to further examine this).
diff --git a/Lib/ctypes/test/test_funcptr.py b/Lib/ctypes/test/test_funcptr.py
index 92bf89b..7ea873f 100644
--- a/Lib/ctypes/test/test_funcptr.py
+++ b/Lib/ctypes/test/test_funcptr.py
@@ -123,11 +123,5 @@
self.failUnlessEqual(strtok(None, "\n"), "c")
self.failUnlessEqual(strtok(None, "\n"), None)
- def test_NULL_funcptr(self):
- tp = CFUNCTYPE(c_int)
- func = tp() # NULL function pointer
- # raise a ValueError when we try to call it
- self.assertRaises(ValueError, func)
-
if __name__ == '__main__':
unittest.main()
diff --git a/Misc/NEWS b/Misc/NEWS
index f892f4d..7cdb1c4 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -217,8 +217,6 @@
- Fix a potential 'SystemError: NULL result without error' in _ctypes.
-- Prevent a segfault when a ctypes NULL function pointer is called.
-
- Bug #1301: Bad assert in _tkinter fixed.
- Patch #1114: fix curses module compilation on 64-bit AIX, & possibly
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
index fe772ac..814b854 100644
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -3305,11 +3305,6 @@
pProc = *(void **)self->b_ptr;
- if (pProc == NULL) {
- PyErr_SetString(PyExc_ValueError,
- "attempt to call NULL function pointer");
- return NULL;
- }
#ifdef MS_WIN32
if (self->index) {
/* It's a COM method */