From 90e832d33f1b42085e1755628b72b2ba9fc748d3 Mon Sep 17 00:00:00 2001 From: "R. Tyler Ballance" Date: Sat, 26 Dec 2009 23:27:49 -0800 Subject: Code using 'INCLUDE_NAMESPACE_REPR_IN_NOTFOUND_EXCEPTIONS' has been turned off for some time, killing it --- cheetah/c/_namemapper.c | 23 ++--------------------- cheetah/c/cheetah.h | 1 - 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/cheetah/c/_namemapper.c b/cheetah/c/_namemapper.c index 9c54f4d..888cca6 100644 --- a/cheetah/c/_namemapper.c +++ b/cheetah/c/_namemapper.c @@ -35,19 +35,7 @@ static PyObject* pprintMod_pformat; /* used for exception formatting */ static void setNotFoundException(char *key, PyObject *namespace) { PyObject *exceptionStr = NULL; - PyObject *namespaceStr = NULL; - - if (INCLUDE_NAMESPACE_REPR_IN_NOTFOUND_EXCEPTIONS) { - namespaceStr = PyObject_CallFunctionObjArgs(pprintMod_pformat, - namespace, NULL); - - exceptionStr = PyUnicode_FromFormat("cannot find \'%s\' in the namespace %S", - namespaceStr); - Py_XDECREF(namespaceStr); - } - else { - exceptionStr = PyUnicode_FromFormat("cannot find \'%s\'", key); - } + exceptionStr = PyUnicode_FromFormat("cannot find \'%s\'", key); PyErr_SetObject(NotFound, exceptionStr); Py_XDECREF(exceptionStr); } @@ -68,17 +56,10 @@ static int wrapInternalNotFoundException(char *fullName, PyObject *namespace) isAlreadyWrapped = PyObject_CallMethod(excValue, "find", "s", "while searching"); if (isAlreadyWrapped != NULL) { - if (PyLong_AsLong(isAlreadyWrapped) == -1) { - /* only wrap once */ + if (PyLong_AsLong(isAlreadyWrapped) == -1) { /* only wrap once */ PyString_ConcatAndDel(&excValue, Py_BuildValue("s", " while searching for '")); PyString_ConcatAndDel(&excValue, Py_BuildValue("s", fullName)); PyString_ConcatAndDel(&excValue, Py_BuildValue("s", "'")); - if (INCLUDE_NAMESPACE_REPR_IN_NOTFOUND_EXCEPTIONS) { - PyString_ConcatAndDel(&excValue, Py_BuildValue("s", " in ")); - PyString_ConcatAndDel(&excValue, Py_BuildValue("s", "the top-level namespace ")); - PyString_ConcatAndDel(&excValue, - PyObject_CallFunctionObjArgs(pprintMod_pformat, namespace, NULL)); - } } Py_DECREF(isAlreadyWrapped); } diff --git a/cheetah/c/cheetah.h b/cheetah/c/cheetah.h index c02781c..f596431 100644 --- a/cheetah/c/cheetah.h +++ b/cheetah/c/cheetah.h @@ -50,7 +50,6 @@ */ #define MAXCHUNKS 15 /* max num of nameChunks for the arrays */ #define ALLOW_WRAPPING_OF_NOTFOUND_EXCEPTIONS 1 -#define INCLUDE_NAMESPACE_REPR_IN_NOTFOUND_EXCEPTIONS 0 #define createNameCopyAndChunks() {\ nameCopy = malloc(strlen(name) + 1);\ tmpPntr1 = name; \ -- cgit v1.2.1