#include "catacomb-python.h"
+/*----- External values ---------------------------------------------------*/
+
+static PyObject *modname = 0;
+
/*----- Conversions -------------------------------------------------------*/
PyObject *getulong(unsigned long w)
unsigned long *p = pp;
PyObject *t;
+ if (!o) VALERR("can't delete");
if (PyInt_Check(o)) {
i = PyInt_AS_LONG(o);
if (i < 0) VALERR("must be nonnegative");
int convbool(PyObject *o, void *pp)
{
+ if (!o) VALERR("can't delete");
*(int *)pp = PyObject_IsTrue(o);
return (1);
+end:
+ return (0);
}
/*----- Type messing ------------------------------------------------------*/
ty->ht_name = PyString_FromString(ty->ht_type.tp_name);
if (ty->ht_name)
ty->ht_type.tp_name = PyString_AS_STRING(ty->ht_name);
- PyObject_INIT(&ty->ht_type, metaty);
+ DISCARD(PyObject_INIT(&ty->ht_type, metaty));
Py_INCREF(metaty);
return (ty);
}
+void typeready(PyTypeObject *ty)
+{
+ PyType_Ready(ty);
+ PyDict_SetItemString(ty->tp_dict, "__module__", modname);
+}
+
PyTypeObject *inittype(PyTypeObject *tyskel)
{
PyTypeObject *ty = newtype(&PyType_Type, tyskel, 0);
ty->tp_flags |= Py_TPFLAGS_HEAPTYPE;
- PyType_Ready(ty);
+ typeready(ty);
return (ty);
}
0 /* @sq_inplace_repeat@ */
};
-int gmap_pysize(PyObject *me)
+Py_ssize_t gmap_pysize(PyObject *me)
{
PyObject *i = 0, *x = 0;
int rc = -1;
void util_pyinit(void)
{
+ modname = PyString_FromString("catacomb");
INITTYPE(itemiter, root);
INITTYPE(valiter, root);
}