* Contains variable linking and pointer type-checking code.
************************************************************************/
+#include "Python.h"
+
#include <string.h>
#include <stdlib.h>
-#include "Python.h"
-
#ifdef __cplusplus
extern "C" {
#endif
SWIG_GetPtrObj(PyObject *obj, void **ptr, char *type) {
PyObject *sobj = obj;
char *str;
+
if (!PyString_Check(obj)) {
if (!PyInstance_Check(obj) || !(sobj = PyObject_GetAttrString(obj,"this")))
return "";
Py_DECREF(sobj);
}
str = PyString_AsString(sobj);
+ if (str == NULL)
+ return "";
return SWIG_GetPtr(str,ptr,type);
}