A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2004-October/049630.html below:

Bug [ 959379 ] Implicit close() should check for errors

[Python-Dev] Re: Bug [ 959379 ] Implicit close() should check for errors [Python-Dev] Re: Bug [ 959379 ] Implicit close() should check for errorsPeter Astrand astrand at lysator.liu.se
Tue Oct 26 07:53:02 CEST 2004
On Mon, 25 Oct 2004, David Bolen wrote:

> > I'd like to resolve bug 959379. Here's a naive fix. Comments?
>
> If you're going to match the normal close() processing, shouldn't that
> check the result against EOF and not just != 0?  If for example, the

Yes. Thanks. Here's the new patch. OK to commit?

diff -u -r2.192 fileobject.c
--- fileobject.c	11 Jun 2004 04:49:03 -0000	2.192
+++ fileobject.c	26 Oct 2004 05:50:12 -0000
@@ -304,7 +304,8 @@
 		PyObject_ClearWeakRefs((PyObject *) f);
 	if (f->f_fp != NULL && f->f_close != NULL) {
 		Py_BEGIN_ALLOW_THREADS
-		(*f->f_close)(f->f_fp);
+		if ((*f->f_close)(f->f_fp) == EOF)
+			perror("close failed");
 		Py_END_ALLOW_THREADS
 	}
 	PyMem_Free(f->f_setbuf);



/Peter Åstrand <astrand at lysator.liu.se>

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4