ReRe: Kjbuckets-Module, Python 1.6 and NT

spex66 at my-deja.com spex66 at my-deja.com
Tue Jun 20 08:15:56 EDT 2000


Hi Robert,

Robert Kern <kern at caltech.edu> schrieb in im Newsbeitrag:
394E751F.DE9E5FF4 at caltech.edu...
> That is, kjbuckets has several extension types.  There will be lines
> like the following (taken from the FAQ, not kjbuckets):
>
>   statichere PyTypeObject bstreamtype = {
>       PyObject_HEAD_INIT(&PyType_Type)
>       0,
>       "bstream",
>       sizeof(bstreamobject),
>   ...
>
>
> Replace &PyType_Type with NULL.  Then add something like the following
> line to the initialization module:
>
>       bstreamtype.ob_type = &PyType_Type;
>
> Repeat for all extension types.

work for this problem. I added your mentioned code here (maybe helpful
for
Thomas Freytag, or for me, if I'm totally wrong :))

/* internal allocation function for table wrappers */
static object * newWrapper(long expectedsize, enum BucketFlag flag)
{
  /* allocate one wrapper */
  TableWrapper *wp;
  Dprint(("WnewWrapper\n"));
  wp = NEW(TableWrapper, 1);
  if (wp == NULL) {
    return err_nomem(); /* allocation failure */
  }
  switch (flag) {
  case SETFLAG:
    kjSettype.ob_type = &PyType_Type;
    wp->ob_type = &kjSettype; break;
  case DICTFLAG:
    kjDicttype.ob_type = &PyType_Type;
    wp->ob_type = &kjDicttype; break;
  case GRAPHFLAG:
    kjGraphtype.ob_type = &PyType_Type;
    wp->ob_type = &kjGraphtype; break;
  default:
    err_setstr(SystemError, "invalid internal table flag");
    return NULL;
  }


compiled the code without an error or a warning, into kjbuckets.dll and
dropped it in the Python/DLLs directory

then I get:
>>> from kjbuckets import *
Traceback (innermost last):
  File "<pyshell#1>", line 1, in ?
    from kjbuckets import *
ImportError: dynamic module does not define init function
(initkjbuckets)

any ideas??? the initkjbuckets is declared:
void
initkjbuckets()
{
  initmodule("kjbuckets", kjbuckets_methods);
}

/* end of kjbuckets module by Aaron Watters */



thanks

Peter Arwanitis
(=PA=)


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list