Lisandro Dalcin wrote:
> Here you have a preliminary patch for loading the refnanny API
> skipping dlopen() hackery.
>
> For this to work, just make Cython/Runtime/refnanny.pyx a extension
> module, and put it somewhere in your PYTHONPATH. That's all!! Now
> build other extensions with -DCYTHON_REFNANNY and enjoy...
>
> Take into account that I'm not completelly happy with the current
> patch, more work is required.
>
> 1) As namespaces are a honking great idea, I do not see the point of
> using "Refnanny" prefixes on class and function names at refnanny.py
>   
By all means.

> 2) I'm a bit uncomfortable with the way I had to initialize stuff at
> module initialization function.
>   
Looks OK with me.
> 3) Many unittests in mpi4py pass, but I'm also gettting some
> segfaults. In particular, the refnanny stuff should no be emmited for
> "pure" cdef functions (I mean, those with no Python objects at all in
> args, retvals and local vars). For example, in mpi4py I have a
> finalizer routine that is registered with Py_AtExit(), then it is
> called after Py_Finalize(), thus no Python code should run. I'm also
> getting some bad interaction between refnanny and exception handling,
> but I need to dive deeper to catch the problem, no yet sure what is
> going on.
>   
Can't you declare the function as "nogil"? I.e.

cdef nogil int myfunc(): ...

I already disable the refnanny if "nogil" is declared, and then Python 
operations are disallowed. Doing this automatically though is a bit 
hard, I'd have to make sure that no Python temporaries are ever 
constructed in the function, which is more than a five-minute job. If 
you give a good reason the nogil modifier doesn't do the trick I can 
look into it.

I've applied your patch, thanks! RTLD_GLOBAL-issues aside, it is a lot 
easier to set up the refnanny on other code than the test suite now.

Please vote: Should we install the refnanny into site-packages when 
doing a Cython install? Then we could just tell users "try compiling 
with the -DCYTHON_REFNANNY flag" to get diagnostics.

Dag Sverre
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to