[Python-checkins] cpython (merge 3.4 -> default): Closes #21931: Merge with 3.4
zach.ware
python-checkins at python.org
Mon May 18 07:49:20 CEST 2015
https://hg.python.org/cpython/rev/cb0d1d86215e
changeset: 96132:cb0d1d86215e
parent: 96130:16d0e3dda31c
parent: 96131:41281737d71a
user: Zachary Ware <zachary.ware at gmail.com>
date: Mon May 18 00:49:15 2015 -0500
summary:
Closes #21931: Merge with 3.4
files:
Misc/NEWS | 4 ++++
PC/_msi.c | 15 ++++++++++++---
2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -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 --git a/PC/_msi.c b/PC/_msi.c
--- a/PC/_msi.c
+++ b/PC/_msi.c
@@ -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;
}
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list