A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2005-June/054334.html below:

[Python-Dev] gcmodule issue w/adding __del__ to generator objects

[Python-Dev] gcmodule issue w/adding __del__ to generator objectsPhillip J. Eby pje at telecommunity.com
Sat Jun 18 23:50:36 CEST 2005
Working on the PEP 342/343 generator enhancements, I've got working 
send/throw/close() methods, but am not sure how to deal with getting 
__del__ to invoke close().  Naturally, I can add a "__del__" entry to its 
methods list easily enough, but the 'has_finalizer()' function in 
gcmodule.c only checks for a __del__ attribute on instance objects, and for 
tp_del on heap types.

It looks to me like the correct fix would be to check for tp_del always, 
not just on heap types.  However, when I tried this, I started getting 
warnings from the tests, saying that 22 uncollectable objects were being 
created (all generators, in test_generators).

It seems that the tests create cycles via globals(), since they define a 
bunch of generator functions and then call them, saving the generator 
iterators (or objects that reference them) in global variables

after investigating this a bit, it seems to me that either has_finalizer() 
needs to 

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4