Issue1803227

classification
Title: Jython allowed to creat weak Ref for List ,Tuple and Dict
Type: Severity: normal
Components: Core Versions:
Milestone:
process
Status: closed Resolution: invalid
Dependencies: Superseder:
Assigned To: Nosy List: cgroves, ukeshav
Priority: urgent Keywords:

Created on 2007-09-27.05:13:58 by ukeshav, last changed 2007-09-27.06:02:16 by cgroves.

Messages
msg1946 (view) Author: keshav upadhyaya (ukeshav) Date: 2007-09-27.05:13:58
Jython allowed to creat Weak ref for List , Tuple and Dict object ...

And  does not work properly once we create proxy object to it...

Python does not  support Weak Ref for List ,Tuple and Dict Objects..

i am pasting some work around here...

Python behavior :-

>>> import weakref  as w
>>> a=(1,2,3,4)
>>> b=w.proxy(a)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: cannot create weak reference to 'tuple' object

jython behavior :-

>>> import weakref  as w
>>> a=(1,2,3,4)
>>> b=w.proxy(a)
>>> b
<weakref 1 to 'tuple' object 2>
>>> a=None
>>> b
<weakref 1 to 'tuple' object 2>

:- here b sud be None Type because a is None..
but it does not work at all because in java it is depends on the mood of Garbage collector.  :)




msg1947 (view) Author: Charlie Groves (cgroves) Date: 2007-09-27.06:02:16
Everything is at the mercy of the garbage collector in Jython, not just weak references.  Python objects won't be finalized immediately  on leaving a scope like they are in CPython either.  That garbage collection allows us to have weak refs to types CPython doesn't support is a feature, not a bug.
History
Date User Action Args
2007-09-27 05:13:58ukeshavcreate