File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -57,13 +57,6 @@ PyCObject_FromVoidPtr(cobj, destr)
5757 return (PyObject * )self ;
5858}
5959
60- void *
61- PyCObject_AsVoidPtr (self )
62- PyObject * self ;
63- {
64- return ((PyCObject * )self )-> cobject ;
65- }
66-
6760static void
6861PyCObject_dealloc (self )
6962 PyCObject * self ;
@@ -105,3 +98,21 @@ PyTypeObject PyCObject_Type = {
10598 0L ,0L ,0L ,0L ,
10699 PyCObject_Type__doc__ /* Documentation string */
107100};
101+
102+ void *
103+ PyCObject_AsVoidPtr (self )
104+ PyObject * self ;
105+ {
106+ if (self )
107+ {
108+ if (self -> ob_type == & PyCObject_Type )
109+ return ((PyCObject * )self )-> cobject ;
110+ PyErr_SetString (PyExc_TypeError ,
111+ "PyCObject_AsVoidPtr with non-C-object" );
112+ }
113+ if (! PyErr_Occurred ())
114+ PyErr_SetString (
115+ PyExc_TypeError ,
116+ "PyCObject_AsVoidPtr called with null pointer" );
117+ return NULL ;
118+ }
You can’t perform that action at this time.
0 commit comments