[pylucene-dev] two different JCC modules in same VM; initVM()?

Bill Janssen janssen at parc.com
Thu Mar 6 19:00:58 PST 2008


> Hmmm, when I think about it, there's no way this can work.  The
> comparison in jcc.cpp is
> 
>         if (!PyObject_TypeCheck((PyObject *) jccenv, &JCCEnvType))
> 
> and PyObject_TypeCheck compares the two pointers for equality, but the
> two different "JCCEnvType" variables are in two different shared
> libraries.  So they'll never match.

So I tried changing this to

       if (strncmp(((PyObject *) jccenv)->ob_type->tp_name,
                    JCCEnvType.tp_name,
                    strlen(JCCEnvType.tp_name)) != 0)

But now I get this:

>>> goodstuff.initVM(env=lucene.getVMEnv(), classpath=":".join([lucene.CLASSPATH, "GoodStuff.jar"]))
[Switching to Thread -1208796976 (LWP 28390)]

Breakpoint 1, initVM (self=0x0, args=0xb7ef302c, kwds=0xa2d8934)
    at /usr/lib/python2.5/site-packages/JCC-1.8-py2.5-linux-i686.egg/jcc/sources/jcc.cpp:561
561	        if (classpath)
(gdb) p classpath
$7 = 0xa2c3d6c "/usr/lib/python2.5/site-packages/lucene-2.3.0-py2.5-linux-i686.egg/lucene/lucene-core-2.3.0.jar:/usr/lib/python2.5/site-packages/lucene-2.3.0-py2.5-linux-i686.egg/lucene/lucene-snowball-2.3.0.jar:/usr"...
(gdb) s
562	            env->setClassPath(classpath);
(gdb) s

Program received signal SIGSEGV, Segmentation fault.
0x00c9db70 in initVM (self=0x0, args=0xb7ef302c, kwds=0xa2d8934)
    at /usr/lib/python2.5/site-packages/JCC-1.8-py2.5-linux-i686.egg/jcc/sources/jcc.cpp:562
562	            env->setClassPath(classpath);
(gdb) p env
$8 = (class JCCEnv *) 0x9f5cce0
(gdb) p *env
$9 = {_vptr.JCCEnv = 0x136f9c8, _sys = 0x9ff6554, _obj = 0x9ff6558, _thr = 0x9ff655c, _mids = 0x9f5cd38, vm = 0x19f792c, 
  refs = {_M_t = {
      _M_impl = {<std::allocator<std::_Rb_tree_node<std::pair<const int, countedRef> > >> = {<__gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<const int, countedRef> > >> = {<No data fields>}, <No data fields>}, 
        _M_key_compare = {<> = {<No data fields>}, <No data fields>}, _M_header = {_M_color = std::_S_red, 
          _M_parent = 0x9f5cf18, _M_left = 0xa2ac770, _M_right = 0xa013a20}, _M_node_count = 226}}}, static VM_ENV = 0}
(gdb)


More information about the pylucene-dev mailing list