Meador Inge added the comment: The monkey-patched version breaks the auto-close on __del__ feature:
[meadori@li589-207 cpython]$ ./python Python 3.4.0a1+ (default:c41c68a18bb6, Sep 5 2013, 17:51:03) [GCC 4.7.2 20120921 (Red Hat 4.7.2-2)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import tempfile >>> tempfile.NamedTemporaryFile(dir=".",delete=False).write(b"hello") __main__:1: ResourceWarning: unclosed file <_io.BufferedRandom name=4> 5 Also run the test suite with '-R :' and you will see tons of resource warnings. Breaking auto-close is because now unlinking *and* closing are being guarded by 'delete'. Even if that is fixed you still run into resource leak problems. Looks like the monkey-patching introduces a reference cycle. The wrapper binding approach works fine in all the tests I did. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue18879> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com