Message75431
| Author |
christian.heimes |
| Recipients |
amaury.forgeotdarc, christian.heimes |
| Date |
2008年10月31日.21:37:40 |
| SpamBayes Score |
6.1874887e-09 |
| Marked as misclassified |
No |
| Message-id |
<1225489062.5.0.646105339228.issue4233@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
I don't see a good 'n easy way to fix the issue. close() is called in
too many places and I don't wanna add more checks in Python code.
This patch reduces the mass of warnings to one, but it also changes the
semantic of close() a bit. However it seems logical to set the fd
attribute of the file object to -1 (meaning closed).
Index: Modules/_fileio.c
===================================================================
--- Modules/_fileio.c (Revision 67068)
+++ Modules/_fileio.c (Arbeitskopie)
@@ -60,7 +60,8 @@
static PyObject *
fileio_close(PyFileIOObject *self)
{
- if (!self->closefd) {
+ if (!self->closefd && self->fd >= 0) {
+ self->fd = -1;
if (PyErr_WarnEx(PyExc_RuntimeWarning,
"Trying to close unclosable fd!", 3) < 0) {
return NULL; |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2008年10月31日 21:37:42 | christian.heimes | set | recipients:
+ christian.heimes, amaury.forgeotdarc |
| 2008年10月31日 21:37:42 | christian.heimes | set | messageid: <1225489062.5.0.646105339228.issue4233@psf.upfronthosting.co.za> |
| 2008年10月31日 21:37:41 | christian.heimes | link | issue4233 messages |
| 2008年10月31日 21:37:40 | christian.heimes | create |
|