That's a CPython implementation detail.
https://docs.python.org/3/reference/datamodel.html
> Do not depend on immediate finalization of objects when they become unreachable (so you should always close files explicitly).
That's a CPython implementation detail.
https://docs.python.org/3/reference/datamodel.html
> Do not depend on immediate finalization of objects when they become unreachable (so you should always close files explicitly).