IndexError when showing traceback at Pylons

Issue #135 resolved
created an issue

Pylons has a _debug controller that shows past exception tracebacks. When a user follows the debug link shown in console an exception occurs:

Exception happened during processing of request from ('', 49212) Traceback (most recent call last): File "/usr/lib/pymodules/python2.6/paste/", line 1068, in process_request_in_thread self.finish_request(request, client_address) File "/usr/lib/python2.6/", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/usr/lib/python2.6/", line 615, in init self.handle() File "/usr/lib/pymodules/python2.6/paste/", line 442, in handle BaseHTTPRequestHandler.handle(self) File "/usr/lib/python2.6/", line 329, in handle self.handle_one_request() File "/usr/lib/pymodules/python2.6/paste/", line 437, in handle_one_request self.wsgi_execute() File "/usr/lib/pymodules/python2.6/paste/", line 287, in wsgi_execute self.wsgi_start_response) File "/usr/lib/pymodules/python2.6/paste/", line 130, in call return self.apps[-1](environ, start_response) File "/usr/lib/pymodules/python2.6/paste/", line 375, in call app_iter = self.application(environ, start_response) File "/usr/lib/pymodules/python2.6/pylons/", line 200, in call, environ, catch_exc_info=True) File "/usr/lib/pymodules/python2.6/pylons/", line 91, in call_wsgi_application app_iter = application(environ, start_response) File "/usr/lib/pymodules/python2.6/weberror/", line 233, in call return self.debug(req)(environ, start_response) File "/usr/lib/pymodules/python2.6/weberror/", line 535, in wsgi_application return self.content() File "/usr/lib/pymodules/python2.6/weberror/", line 545, in content result = tmpl_formatter(self.exc_value) File "/usr/lib/pymodules/python2.6/pylons/", line 43, in mako_html_data css=False) File "/usr/lib/pymodules/python2.6/mako/", line 189, in render return runtime._render(self, self.callable_, args, data) File "/usr/lib/pymodules/python2.6/mako/", line 403, in _render _render_context(template, callable_, context, *args, _kwargs_for_callable(callable_, data)) File "/usr/lib/pymodules/python2.6/mako/", line 434, in _render_context _exec_template(inherit, lclcontext, args=args, kwargs=kwargs) File "/usr/lib/pymodules/python2.6/mako/", line 457, in _exec_template callable_(context, *args, kwargs) File "memory:0x249a510", line 54, in render_body File "/usr/lib/pymodules/python2.6/mako/", line 88, in init self.records = self._init(traceback) File "/usr/lib/pymodules/python2.6/mako/", line 201, in _init fp = open(new_trcback[-1][0], 'rb') IndexError: list index out of range

In particular, trcback is None so any index value would raise an IndexError. This would also be Pylon's fault as the exception is not properly replayed.

A patch is attached.

Comments (5)

  1. guest reporter

    I don't think it is a duplicate because the exception in this case is IndexError not AttributeError.

    I can't manage to get a standalone test case, but as long as there is a way to raise a mako exception with an empty traceback (i.e. None), a mako IndexError will be generated.

  2. Log in to comment