kore

Kore is a web application platform for writing scalable, concurrent web based processes in C or Python.
Commits | Files | Refs | README | LICENSE | git clone https://git.kore.io/kore.git

commit 3e85d36532f60bfd31970dd5ea52ccd001dda7ae
parent af45284641878da4a407e6f8ee2cdf0acbf5f717
Author: Joris Vink <joris@coders.se>
Date:   Wed, 22 Sep 2021 16:48:21 +0200

The *_CheckExact() family sets no exceptions.

So set a runtime exception if the objects passed mismatch.

Diffstat:
src/python.c | 10++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/python.c b/src/python.c @@ -5151,13 +5151,17 @@ pydomain_filemaps(struct pydomain *domain, PyObject *args) if (!PyArg_ParseTuple(args, "O", &dict)) return (NULL); - if (!PyDict_CheckExact(dict)) + if (!PyDict_CheckExact(dict)) { + PyErr_SetString(PyExc_RuntimeError, "filemaps not a dict"); return (NULL); + } idx = 0; while (PyDict_Next(dict, &idx, &key, &value)) { if (!PyUnicode_CheckExact(key) || !PyUnicode_CheckExact(value)) { + PyErr_SetString(PyExc_RuntimeError, + "filemap entries not strings"); return (NULL); } @@ -5318,8 +5322,10 @@ python_route_methods(PyObject *obj, PyObject *kwargs, struct kore_route *rt) int method; Py_ssize_t list_len, idx; - if (!PyList_CheckExact(obj)) + if (!PyList_CheckExact(obj)) { + PyErr_SetString(PyExc_RuntimeError, "methods not a list"); return (KORE_RESULT_ERROR); + } rt->methods = 0; list_len = PyList_Size(obj);