summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Bendersky <eliben@gmail.com>2013-03-06 14:21:46 (GMT)
committerEli Bendersky <eliben@gmail.com>2013-03-06 14:21:46 (GMT)
commit3612da6b2bcb6e4658333e07e55ecb7432f10471 (patch)
treed66b137c5cae7d6ec4c6186c3e56635bf9f875fd
parentd867bad0fc70f0d748975e2b522a072c0e530a4c (diff)
downloadcpython-3612da6b2bcb6e4658333e07e55ecb7432f10471.zip
cpython-3612da6b2bcb6e4658333e07e55ecb7432f10471.tar.gz
cpython-3612da6b2bcb6e4658333e07e55ecb7432f10471.tar.bz2
call_commethod was only used in samples/Windows, which no longer exists.
This method is dead code - not documented, not tested. As far as we know, it can be horribly broken.
-rw-r--r--Misc/NEWS3
-rw-r--r--Modules/_ctypes/callproc.c57
2 files changed, 3 insertions, 57 deletions
diff --git a/Misc/NEWS b/Misc/NEWS
index a0dd2f6..adecfe2 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -881,6 +881,9 @@ Library
`sha3_256`, `sha3_384` and `sha3_512`. As part of the patch some common
code was moved from _hashopenssl.c to hashlib.h.
+- ctypes.call_commethod was removed, since its only usage was in the defunct
+ samples directory.
+
Extension Modules
-----------------
diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c
index 5670fd2..e72f256 100644
--- a/Modules/_ctypes/callproc.c
+++ b/Modules/_ctypes/callproc.c
@@ -1263,62 +1263,6 @@ static PyObject *free_library(PyObject *self, PyObject *args)
return Py_None;
}
-/* obsolete, should be removed */
-/* Only used by sample code (in samples\Windows\COM.py) */
-static PyObject *
-call_commethod(PyObject *self, PyObject *args)
-{
- IUnknown *pIunk;
- int index;
- PyObject *arguments;
- PPROC *lpVtbl;
- PyObject *result;
- CDataObject *pcom;
- PyObject *argtypes = NULL;
-
- if (!PyArg_ParseTuple(args,
- "OiO!|O!",
- &pcom, &index,
- &PyTuple_Type, &arguments,
- &PyTuple_Type, &argtypes))
- return NULL;
-
- if (argtypes && (PyTuple_GET_SIZE(arguments) != PyTuple_GET_SIZE(argtypes))) {
- PyErr_Format(PyExc_TypeError,
- "Method takes %d arguments (%d given)",
- PyTuple_GET_SIZE(argtypes), PyTuple_GET_SIZE(arguments));
- return NULL;
- }
-
- if (!CDataObject_Check(pcom) || (pcom->b_size != sizeof(void *))) {
- PyErr_Format(PyExc_TypeError,
- "COM Pointer expected instead of %s instance",
- Py_TYPE(pcom)->tp_name);
- return NULL;
- }
-
- if ((*(void **)(pcom->b_ptr)) == NULL) {
- PyErr_SetString(PyExc_ValueError,
- "The COM 'this' pointer is NULL");
- return NULL;
- }
-
- pIunk = (IUnknown *)(*(void **)(pcom->b_ptr));
- lpVtbl = (PPROC *)(pIunk->lpVtbl);
-
- result = _ctypes_callproc(lpVtbl[index],
- arguments,
-#ifdef MS_WIN32
- pIunk,
- NULL,
-#endif
- FUNCFLAG_HRESULT, /* flags */
- argtypes, /* self->argtypes */
- NULL, /* self->restype */
- NULL); /* checker */
- return result;
-}
-
static char copy_com_pointer_doc[] =
"CopyComPointer(src, dst) -> HRESULT value\n";
@@ -1813,7 +1757,6 @@ PyMethodDef _ctypes_module_methods[] = {
{"FormatError", format_error, METH_VARARGS, format_error_doc},
{"LoadLibrary", load_library, METH_VARARGS, load_library_doc},
{"FreeLibrary", free_library, METH_VARARGS, free_library_doc},
- {"call_commethod", call_commethod, METH_VARARGS },
{"_check_HRESULT", check_hresult, METH_VARARGS},
#else
{"dlopen", py_dl_open, METH_VARARGS,