summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1999-10-26 00:12:20 (GMT)
committerGuido van Rossum <guido@python.org>1999-10-26 00:12:20 (GMT)
commit25da5bebd8875728f1719ddc0f70dde529cec224 (patch)
tree0dd5ecd379b99e12ff0d1c65c2880b9348c384b6
parente1ada50559c94da6fe7d16dd205f17e02d1f0aee (diff)
downloadcpython-25da5bebd8875728f1719ddc0f70dde529cec224.zip
cpython-25da5bebd8875728f1719ddc0f70dde529cec224.tar.gz
cpython-25da5bebd8875728f1719ddc0f70dde529cec224.tar.bz2
Fix PR117. The error message is "keywords must be strings". Perhaps
not as descriptive as what Barry suggests, but this also catches the (in my opinion important) case where some other C code besides apply() constructs a kwdict that doesn't have the right format. All the other possibilities of getting it wrong (non-dict, wrong keywords etc) are already caught so this makes sense to check here.
-rw-r--r--Python/ceval.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 4c1bf2f..fe2e0a2 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -482,6 +482,11 @@ eval_code2(co, globals, locals,
PyObject *keyword = kws[2*i];
PyObject *value = kws[2*i + 1];
int j;
+ if (keyword == NULL || !PyString_Check(keyword)) {
+ PyErr_SetString(PyExc_TypeError,
+ "keywords must be strings");
+ goto fail;
+ }
/* XXX slow -- speed up using dictionary? */
for (j = 0; j < co->co_argcount; j++) {
PyObject *nm = PyTuple_GET_ITEM(