Message197016
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. |
|
Date |
User |
Action |
Args |
2013-09-05 18:34:42 | meador.inge | set | recipients:
+ meador.inge, georg.brandl, ncoghlan, vstinner, r.david.murray, serhiy.storchaka, jort.bloem, jstasiak |
2013-09-05 18:34:42 | meador.inge | set | messageid: <1378406082.33.0.00973210525882.issue18879@psf.upfronthosting.co.za> |
2013-09-05 18:34:42 | meador.inge | link | issue18879 messages |
2013-09-05 18:34:41 | meador.inge | create | |
|