Fix SF bug #690012 (among others), iconv_codec stops build

Change setup.py to catch all exceptions.
  - Rename module if the exception was an ImportError
  - Only warn if the exception was any other error

Revert _iconv_codec to raising a RuntimeError.
This commit is contained in:
Neal Norwitz 2003-02-28 17:21:39 +00:00
parent edaa071eb4
commit 3f5fcc8acc
2 changed files with 8 additions and 6 deletions

View file

@ -674,14 +674,14 @@ init_iconv_codec(void)
iconv_t hdl = iconv_open(UNICODE_ENCODING, "ISO-8859-1");
if (hdl == (iconv_t)-1) {
PyErr_SetString(PyExc_ImportError,
PyErr_SetString(PyExc_RuntimeError,
"can't initialize the _iconv_codec module: iconv_open() failed");
return;
}
res = iconv(hdl, &inptr, &insize, &outptr, &outsize);
if (res == (size_t)-1) {
PyErr_SetString(PyExc_ImportError,
PyErr_SetString(PyExc_RuntimeError,
"can't initialize the _iconv_codec module: iconv() failed");
return;
}
@ -698,7 +698,7 @@ init_iconv_codec(void)
byteswap = 1;
else {
iconv_close(hdl);
PyErr_SetString(PyExc_ImportError,
PyErr_SetString(PyExc_RuntimeError,
"can't initialize the _iconv_codec module: mixed endianess");
return;
}