Jython, GILs and object locking.

Ype Kingma ykingma at accessforall.nl
Fri Oct 17 00:39:30 EDT 2003


Daniel Dittmar wrote:

> Alan Kennedy wrote:
>> However, I don't understand what problems jython "already has" in
>> relation to removal of the GIL: jython doesn't have a GIL.
> 
> I was referring to the removal of reference counting, not removal of the
> GIL. Removing reference counting will change code that relies on the
> fact that the __del__ methods is called when the object falls out of
> scope. Instead, __del__ is called when the object is reclaimed by the
> garbage collector (although not in the current Python implementation, if
> I remember right).
> 
> So removing reference counting changes the meaning of existing Python
> programs (CPython). If you're running you're programs under Jython, then
>   you have already this behaviour. This is what I meant by "Jython has
> already these problems".

The bright side of death of Python objects is (quoting from
http://www.python.org/doc/current/ref/objects.html#l2h-18),

 Objects are never explicitly destroyed; however, when they become
 unreachable they may be garbage-collected. An implementation is allowed
 to postpone garbage collection or omit it altogether -- it is a matter of
 implementation quality how garbage collection is implemented, as long as no
 objects are collected that are still reachable.

(Just before they draw their terminal breath.
Modulation upwards, and repeat...)

Python programs that expect __del__ to be called immediately
when an object becomes unreachable are relying on CPython behaviour.

Jython does not have "these problems". It just has another garbage
collecting method than CPython, and normally __del__ is called from
another thread.

Ype

tadam (4x)

-- 
email at xs4all.nl




More information about the Python-list mailing list