[Python.NET] ANNOUNCE: Python for .NET beta 5 now available

Brian Lloyd brian at zope.com
Thu Mar 31 16:55:29 CEST 2005

> >Forgetting to manage the lock around a callback into Python 
> >is almost certain to cause a NullReferenceException (because 
> >there will be no valid thread state when the callback is 
> >made).
> >  
> >
> Is this take care of when a C# instance calls a delegate, wich is a
> python function? Or do we need to take the same care? (i.e. wrap the
> call to the delegate in a AcquireLock/ReleaseLock section).
> thanks!
> Stan.

No, I was just starting to look at your report, and I don't 
_think_ its the same thing.

When PythonNet creates a delegate with a Python implementation, 
it generates the actual managed wrapper delegate and includes the 
necessary calls to AcquireLock() and ReleaseLock().

There are a bunch of unit tests for delegates that don't exhibit 
this behavior - the main difference I can see is that your 
delegate runs on a different thread (which shouldn't matter, but 
its a place to start).

Brian Lloyd        brian at zope.com
V.P. Engineering   540.361.1716              
Zope Corporation   http://www.zope.com 

More information about the PythonDotNet mailing list