Closes #21931: Merge with 3.4

This commit is contained in:
Zachary Ware 2015-05-18 00:49:15 -05:00
commit f4e6030542
2 changed files with 16 additions and 3 deletions

View File

@ -47,6 +47,10 @@ Core and Builtins
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 #13866: *quote_via* argument added to urllib.parse.urlencode.
- Issue #20098: New mangle_from_ policy option for email, default True

View File

@ -243,8 +243,13 @@ static PyObject* fcicreate(PyObject* obj, PyObject* args)
for (i=0; i < PyList_GET_SIZE(files); i++) {
PyObject *item = PyList_GET_ITEM(files, i);
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,
cb_getnextcabinet, cb_status, cb_getopeninfo,
tcompTYPE_MSZIP))
@ -260,7 +265,11 @@ static PyObject* fcicreate(PyObject* obj, PyObject* args)
Py_INCREF(Py_None);
return Py_None;
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);
return NULL;
}