[Python-checkins] r61523 - in python/trunk: Modules/_fileio.c Modules/main.c Modules/posixmodule.c Modules/socketmodule.c Objects/fileobject.c
brett.cannon
python-checkins at python.org
Tue Mar 18 16:35:58 CET 2008
Author: brett.cannon
Date: Tue Mar 18 16:35:58 2008
New Revision: 61523
Modified:
python/trunk/Modules/_fileio.c
python/trunk/Modules/main.c
python/trunk/Modules/posixmodule.c
python/trunk/Modules/socketmodule.c
python/trunk/Objects/fileobject.c
Log:
Remove all traces of HAVE_STRERROR.
The removal of strerror.c led to the function check being removed from
configure.in.
Modified: python/trunk/Modules/_fileio.c
==============================================================================
--- python/trunk/Modules/_fileio.c (original)
+++ python/trunk/Modules/_fileio.c Tue Mar 18 16:35:58 2008
@@ -104,11 +104,7 @@
if (self->fd < 0)
return 0;
if (fstat(self->fd, &buf) == 0 && S_ISDIR(buf.st_mode)) {
-#ifdef HAVE_STRERROR
char *msg = strerror(EISDIR);
-#else
- char *msg = "Is a directory";
-#endif
PyObject *exc;
internal_close(self);
@@ -295,12 +291,8 @@
if (self->fd >= 0 && self->closefd) {
errno = internal_close(self);
if (errno < 0) {
-#ifdef HAVE_STRERROR
PySys_WriteStderr("close failed: [Errno %d] %s\n",
errno, strerror(errno));
-#else
- PySys_WriteStderr("close failed: [Errno %d]\n", errno);
-#endif
}
}
Modified: python/trunk/Modules/main.c
==============================================================================
--- python/trunk/Modules/main.c (original)
+++ python/trunk/Modules/main.c Tue Mar 18 16:35:58 2008
@@ -539,13 +539,9 @@
if (sts==-1 && filename!=NULL) {
if ((fp = fopen(filename, "r")) == NULL) {
-#ifdef HAVE_STRERROR
fprintf(stderr, "%s: can't open file '%s': [Errno %d] %s\n",
argv[0], filename, errno, strerror(errno));
-#else
- fprintf(stderr, "%s: can't open file '%s': Errno %d\n",
- argv[0], filename, errno);
-#endif
+
return 2;
}
else if (skipfirstline) {
Modified: python/trunk/Modules/posixmodule.c
==============================================================================
--- python/trunk/Modules/posixmodule.c (original)
+++ python/trunk/Modules/posixmodule.c Tue Mar 18 16:35:58 2008
@@ -6710,7 +6710,6 @@
}
#endif /* unsetenv */
-#ifdef HAVE_STRERROR
PyDoc_STRVAR(posix_strerror__doc__,
"strerror(code) -> string\n\n\
Translate an error code to a message string.");
@@ -6730,7 +6729,6 @@
}
return PyString_FromString(message);
}
-#endif /* strerror */
#ifdef HAVE_SYS_WAIT_H
@@ -8510,9 +8508,7 @@
#ifdef HAVE_UNSETENV
{"unsetenv", posix_unsetenv, METH_VARARGS, posix_unsetenv__doc__},
#endif
-#ifdef HAVE_STRERROR
{"strerror", posix_strerror, METH_VARARGS, posix_strerror__doc__},
-#endif
#ifdef HAVE_FCHDIR
{"fchdir", posix_fchdir, METH_O, posix_fchdir__doc__},
#endif
Modified: python/trunk/Modules/socketmodule.c
==============================================================================
--- python/trunk/Modules/socketmodule.c (original)
+++ python/trunk/Modules/socketmodule.c Tue Mar 18 16:35:58 2008
@@ -3110,15 +3110,10 @@
}
if (h->h_addrtype != af) {
-#ifdef HAVE_STRERROR
/* Let's get real error message to return */
PyErr_SetString(socket_error,
(char *)strerror(EAFNOSUPPORT));
-#else
- PyErr_SetString(
- socket_error,
- "Address family not supported by protocol family");
-#endif
+
return NULL;
}
Modified: python/trunk/Objects/fileobject.c
==============================================================================
--- python/trunk/Objects/fileobject.c (original)
+++ python/trunk/Objects/fileobject.c Tue Mar 18 16:35:58 2008
@@ -83,11 +83,7 @@
return f;
if (fstat(fileno(f->f_fp), &buf) == 0 &&
S_ISDIR(buf.st_mode)) {
-#ifdef HAVE_STRERROR
char *msg = strerror(EISDIR);
-#else
- char *msg = "Is a directory";
-#endif
PyObject *exc = PyObject_CallFunction(PyExc_IOError, "(is)",
EISDIR, msg);
PyErr_SetObject(PyExc_IOError, exc);
@@ -398,11 +394,7 @@
sts = (*f->f_close)(f->f_fp);
Py_END_ALLOW_THREADS
if (sts == EOF)
-#ifdef HAVE_STRERROR
PySys_WriteStderr("close failed: [Errno %d] %s\n", errno, strerror(errno));
-#else
- PySys_WriteStderr("close failed: [Errno %d]\n", errno);
-#endif
}
PyMem_Free(f->f_setbuf);
Py_XDECREF(f->f_name);
More information about the Python-checkins
mailing list