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 | belopolsky |
|---|---|
| Recipients | belopolsky, christian.heimes, ncoghlan |
| Date | 2008年02月10日.22:57:14 |
| SpamBayes Score | 0.0011622111 |
| Marked as misclassified | No |
| Message-id | <1202684239.02.0.936572888364.issue2021@psf.upfronthosting.co.za> |
| In-reply-to |
| Content | |
|---|---|
Nick's comment made me think why NamedTemporaryFile can't simply subclass file and get properly working context manager's methods for free. It turned out that although file is subclassable, in its present form, it does not allow NamedTemporaryFile implementation for the following reasons: 1. os.fdopen cannot create a subclass of file. 2. file.__exit__ does not call subclass' close method. The attached patch fixes both issues and reimplements NamedTemporaryFile. I understand that adding new functionality to file objects should be brought up on python-dev, but I would like to hear comments from the "nosy list" first. The patch is proof-of-concept quality at the moment and may not work non-posix platforms. |
|
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2008年02月10日 22:57:19 | belopolsky | set | spambayes_score: 0.00116221 -> 0.0011622111 recipients: + belopolsky, ncoghlan, christian.heimes |
| 2008年02月10日 22:57:19 | belopolsky | set | spambayes_score: 0.00116221 -> 0.00116221 messageid: <1202684239.02.0.936572888364.issue2021@psf.upfronthosting.co.za> |
| 2008年02月10日 22:57:18 | belopolsky | link | issue2021 messages |
| 2008年02月10日 22:57:17 | belopolsky | create | |