[issue17852] Built-in module _io can loose data from buffered files at exit

Armin Rigo report at bugs.python.org
Thu Dec 4 11:24:42 CET 2014


Armin Rigo added the comment:

If I understood correctly, Python 3.4 tries harder to find cycles and call destructors at the end of the program, but that's not a full guarantee.  For example you can have a reference from a random C extension module.

While trying to come up with an example, I found one that I don't fully understand, but the point is that it shows how easy it is to defeats it:

    import sys
    f = open('foo.txt', 'w')
    f.write('abc')
    def func(*args):
        return func
    sys.settrace(func)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17852>
_______________________________________


More information about the Python-bugs-list mailing list