homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ocean-city
Recipients ocean-city
Date 2009年01月12日.11:19:16
SpamBayes Score 0.0027529234
Marked as misclassified No
Message-id <1231759157.93.0.0851183541991.issue4921@psf.upfronthosting.co.za>
In-reply-to
Content
Hello. Sorry if this is noise. I expected
__del__
out of function
__del__
out of function
__del__
out of function
on following code, but actually I got
out of function
out of function
out of function
__del__
__del__
__del__
Is this expected behavoir? (I believed `a' would be
freed after returned from f(), so I was suprised)
If I remove the comment of gc.collect(), the code works as expected.
///////////////////////////////
import gc
class A:
 def __del__(self):
 print("__del__")
def f():
 a = A()
 def g():
 a
 g()
def main():
 for _ in range(3):
 f()
# gc.collect()
 print("out of function")
if __name__ == '__main__':
 main()
History
Date User Action Args
2009年01月12日 11:19:18ocean-citysetrecipients: + ocean-city
2009年01月12日 11:19:17ocean-citysetmessageid: <1231759157.93.0.0851183541991.issue4921@psf.upfronthosting.co.za>
2009年01月12日 11:19:17ocean-citylinkissue4921 messages
2009年01月12日 11:19:16ocean-citycreate

AltStyle によって変換されたページ (->オリジナル) /