This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author meador.inge
Recipients georg.brandl, jort.bloem, jstasiak, meador.inge, ncoghlan, r.david.murray, serhiy.storchaka, vstinner
Date 2013-09-05.18:34:41
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1378406082.33.0.00973210525882.issue18879@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2013-09-05 18:34:42meador.ingesetrecipients: + meador.inge, georg.brandl, ncoghlan, vstinner, r.david.murray, serhiy.storchaka, jort.bloem, jstasiak
2013-09-05 18:34:42meador.ingesetmessageid: <1378406082.33.0.00973210525882.issue18879@psf.upfronthosting.co.za>
2013-09-05 18:34:42meador.ingelinkissue18879 messages
2013-09-05 18:34:41meador.ingecreate