Opened 14 years ago
Last modified 12 years ago
#13958 closed
There is an error, when a source file with backslash-r returns is interpreted by the Python error report page. — at Initial Version
Reported by: | petrvanblokland | Owned by: | nobody |
---|---|---|---|
Component: | Core (Other) | Version: | 1.2 |
Severity: | Normal | Keywords: | |
Cc: | me@… | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
There is an error, when a source file with backslash-r returns is interpreted by the Python error report page.
Due to a hard split on backslah-n, the lineno is out of range.
Also it is not clear what the name of the file is where this goes wrong.
Adding source = source.replace('\r', '\n') solves the problem, but maybe not structural enough.
Kind regards,
Petr van Blokland
buro@…
Traceback (most recent call last):
File "/Library/Python/2.5/site-packages/django/core/servers/basehttp.py", line 279, in run
self.result = application(self.environ, self.start_response)
File "/Library/Python/2.5/site-packages/django/core/servers/basehttp.py", line 651, in call
return self.application(environ, start_response)
File "/Library/Python/2.5/site-packages/django/core/handlers/wsgi.py", line 241, in call
response = self.get_response(request)
File "/Library/Python/2.5/site-packages/django/core/handlers/base.py", line 137, in get_response
return self.handle_uncaught_exception(request, resolver, exc_info)
File "/Library/Python/2.5/site-packages/django/core/handlers/base.py", line 157, in handle_uncaught_exception
return debug.technical_500_response(request, *exc_info)
File "/Library/Python/2.5/site-packages/django/views/debug.py", line 58, in technical_500_response
html = reporter.get_traceback_html()
File "/Library/Python/2.5/site-packages/django/views/debug.py", line 109, in get_traceback_html
frames = self.get_traceback_frames()
File "/Library/Python/2.5/site-packages/django/views/debug.py", line 228, in get_traceback_frames
pre_context_lineno, pre_context, context_line, post_context = self._get_lines_from_file(filename, lineno, 7, loader, module_name)
File "/Library/Python/2.5/site-packages/django/views/debug.py", line 209, in _get_lines_from_file
context_line = source[lineno].strip('\n')
IndexError: list index out of range