[pypy-dev] html_fibo.py’s problem.

Antonio Cuni anto.cuni at gmail.com
Mon Aug 1 10:05:09 CEST 2011


On 01/08/11 07:25, Kenji Yano wrote:
> Hi
>
> I found the cause of html_fibo.py at the EuroPython Hands-on.
> This case, HtmlTag destructor isn’t call when the object didn’t use.
> Is this garbage collection’s problem?
> (pypy-trunk(1.6.0-dev) same too.)

yes.  The difference with CPython is that CPython destroys the object as soon 
as it forgets the last reference to the object (and thus it is deterministic), 
while on PyPy the objects are destroyed only the the GC runs (which is not 
deterministic).

> runing code and patch are the following link.(not pypy source code patch.)
> https://gist.github.com/1117550

your patch works but it's suboptimal and slower than it need. The proper 
solution would be to add the appropriate calls to .close() to the file and to 
the generator (possibily using the with statement) and also to provide a 
method to HtmlTag to explicitly close the tag instead of relying on the __del__.

> and is this problem in bugs.pypy.org? I can’nt found it.

it works for me:
https://bugs.pypy.org/

you need to explicitly allow our custom SSL certificate, but that's all.

ciao,
Anto


More information about the pypy-dev mailing list