Permalink
Browse files

Code using 'INCLUDE_NAMESPACE_REPR_IN_NOTFOUND_EXCEPTIONS' has been t…

…urned off for some time, killing it
  • Loading branch information...
rtyler committed Dec 27, 2009
1 parent 5716081 commit 90e832d33f1b42085e1755628b72b2ba9fc748d3
Showing with 2 additions and 22 deletions.
  1. +2 −21 cheetah/c/_namemapper.c
  2. +0 −1 cheetah/c/cheetah.h
View
@@ -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);
}
View
@@ -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; \

0 comments on commit 90e832d

Please sign in to comment.