diff options
author | R. Tyler Ballance <tyler@monkeypox.org> | 2009-12-26 23:27:49 -0800 |
---|---|---|
committer | R. Tyler Ballance <tyler@monkeypox.org> | 2009-12-27 15:55:19 -0800 |
commit | 90e832d33f1b42085e1755628b72b2ba9fc748d3 (patch) | |
tree | 1124c5a03c1e418c752d1924ef5429494ff88a24 | |
parent | 571608122feda45e00937484322cfaec82e5cd65 (diff) | |
download | python-cheetah-90e832d33f1b42085e1755628b72b2ba9fc748d3.tar.gz |
Code using 'INCLUDE_NAMESPACE_REPR_IN_NOTFOUND_EXCEPTIONS' has been turned off for some time, killing it
-rw-r--r-- | cheetah/c/_namemapper.c | 23 | ||||
-rw-r--r-- | 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; \ |