changeset: 96132:cb0d1d86215e parent: 96130:16d0e3dda31c parent: 96131:41281737d71a user: Zachary Ware date: Mon May 18 00:49:15 2015 -0500 files: Misc/NEWS description: Closes #21931: Merge with 3.4 diff -r 16d0e3dda31c -r cb0d1d86215e Misc/NEWS --- a/Misc/NEWS Sun May 17 23:46:22 2015 -0500 +++ b/Misc/NEWS Mon May 18 00:49:15 2015 -0500 @@ -47,6 +47,10 @@ 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 diff -r 16d0e3dda31c -r cb0d1d86215e PC/_msi.c --- a/PC/_msi.c Sun May 17 23:46:22 2015 -0500 +++ b/PC/_msi.c Mon May 18 00:49:15 2015 -0500 @@ -243,8 +243,13 @@ 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 @@ 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; }