#30405: IndexError in _get_lines_from_file when module does not match file 
contents
(via loader)
-------------------------------------+-------------------------------------
     Reporter:  Daniel Hahler        |                    Owner:  Hasan
                                     |  Ramezani
         Type:  Bug                  |                   Status:  assigned
    Component:  Error reporting      |                  Version:  2.2
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Hasan Ramezani):

 * owner:  (none) => Hasan Ramezani
 * status:  new => assigned


Comment:

 @Florian, as far as I understand the solution would be something like
 this. am I right?


 {{{
 diff --git a/django/views/debug.py b/django/views/debug.py
 index 86da47ee20..8af1c2e1ca 100644
 --- a/django/views/debug.py
 +++ b/django/views/debug.py
 @@ -349,7 +349,7 @@ class ExceptionReporter:
          if hasattr(loader, 'get_source'):
              try:
                  source = loader.get_source(module_name)
 -            except ImportError:
 +            except Exception:
                  pass
              if source is not None:
                  source = source.splitlines()

 }}}

 If you agree with me I can prepare a patch and include the test.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/30405#comment:5>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.9ed72326e298b2d531b717740f199805%40djangoproject.com.

Reply via email to