mirror of
https://github.com/python/cpython
synced 2026-09-29 12:10:30 +03:00
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:
parent
edaa071eb4
commit
3f5fcc8acc
2 changed files with 8 additions and 6 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue