Message79664
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() |
|
| Date |
User |
Action |
Args |
| 2009-01-12 11:19:18 | ocean-city | set | recipients:
+ ocean-city |
| 2009-01-12 11:19:17 | ocean-city | set | messageid: <[email protected]> |
| 2009-01-12 11:19:17 | ocean-city | link | issue4921 messages |
| 2009-01-12 11:19:16 | ocean-city | create | |
|