mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Issue #21931: Fix error handling in msilib.FCICreate().
Patch by Jeffrey Armstrong.
This commit is contained in:
parent
610a51f364
commit
0a29e898cd
2 changed files with 16 additions and 3 deletions
|
@ -48,6 +48,10 @@ Core and Builtins
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Issue #21931: msilib.FCICreate() now raises TypeError in the case of a bad
|
||||||
|
argument instead of a ValueError with a bogus FCI error number.
|
||||||
|
Patch by Jeffrey Armstrong.
|
||||||
|
|
||||||
- Issue #23796: peak and read1 methods of BufferedReader now raise ValueError
|
- Issue #23796: peak and read1 methods of BufferedReader now raise ValueError
|
||||||
if they called on a closed object. Patch by John Hergenroeder.
|
if they called on a closed object. Patch by John Hergenroeder.
|
||||||
|
|
||||||
|
|
15
PC/_msi.c
15
PC/_msi.c
|
@ -243,8 +243,13 @@ static PyObject* fcicreate(PyObject* obj, PyObject* args)
|
||||||
for (i=0; i < PyList_GET_SIZE(files); i++) {
|
for (i=0; i < PyList_GET_SIZE(files); i++) {
|
||||||
PyObject *item = PyList_GET_ITEM(files, i);
|
PyObject *item = PyList_GET_ITEM(files, i);
|
||||||
char *filename, *cabname;
|
char *filename, *cabname;
|
||||||
if (!PyArg_ParseTuple(item, "ss", &filename, &cabname))
|
|
||||||
goto err;
|
if (!PyArg_ParseTuple(item, "ss", &filename, &cabname)) {
|
||||||
|
PyErr_SetString(PyExc_TypeError, "FCICreate expects a list of tuples containing two strings");
|
||||||
|
FCIDestroy(hfci);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (!FCIAddFile(hfci, filename, cabname, FALSE,
|
if (!FCIAddFile(hfci, filename, cabname, FALSE,
|
||||||
cb_getnextcabinet, cb_status, cb_getopeninfo,
|
cb_getnextcabinet, cb_status, cb_getopeninfo,
|
||||||
tcompTYPE_MSZIP))
|
tcompTYPE_MSZIP))
|
||||||
|
@ -260,7 +265,11 @@ static PyObject* fcicreate(PyObject* obj, PyObject* args)
|
||||||
Py_INCREF(Py_None);
|
Py_INCREF(Py_None);
|
||||||
return Py_None;
|
return Py_None;
|
||||||
err:
|
err:
|
||||||
PyErr_Format(PyExc_ValueError, "FCI error %d", erf.erfOper); /* XXX better error type */
|
if(erf.fError)
|
||||||
|
PyErr_Format(PyExc_ValueError, "FCI error %d", erf.erfOper); /* XXX better error type */
|
||||||
|
else
|
||||||
|
PyErr_SetString(PyExc_ValueError, "FCI general error");
|
||||||
|
|
||||||
FCIDestroy(hfci);
|
FCIDestroy(hfci);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue