Edgewall Software
Modify

Ticket #4349 (closed defect: worksforme)

Opened 5 years ago

Last modified 5 years ago

PygmentsRenderer produces spurious END token

Reported by: Tim Hatch <trac@…> Owned by: cboos
Priority: normal Milestone:
Component: version control/browser Version: devel
Severity: normal Keywords: mimeview
Cc:
Release Notes:
API Changes:

Description

Feed it an empty file and you'll get the following while trying to render:

Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/trac/mimeview/api.py", line 475, in render
    return self._annotate(result, annotations, m and Ranges(m))
  File "/usr/lib/python2.4/site-packages/trac/mimeview/api.py", line 512, in _annotate
    tag.tbody(_body_rows())
  File "build/bdist.linux-i686/egg/genshi/builder.py", line 177, in __call__
  File "build/bdist.linux-i686/egg/genshi/builder.py", line 32, in __call__
  File "build/bdist.linux-i686/egg/genshi/builder.py", line 57, in append
  File "/usr/lib/python2.4/site-packages/trac/mimeview/api.py", line 501, in _body_rows
    for idx, line in enumerate(_group_lines(stream)):
  File "/usr/lib/python2.4/site-packages/trac/mimeview/api.py", line 676, in _group_lines
    for kind, data, pos in _generate():
  File "/usr/lib/python2.4/site-packages/trac/mimeview/api.py", line 671, in _generate
    stack.pop()
IndexError: pop from empty list

This is the entirety of the events which causes this traceback, generated by the PygmentsRenderer?:

'END', QName(u'span'), (None, -1, -1)

I believe this is caused by yielding an END token regardless of whether a span was open (lattrs is None). Attempting to correct for this is proving quite confusing because it won't produce the number of \n that seems logical. I think this needs another pair of eyes.

Attachments

Change History

comment:1 Changed 5 years ago by Tim Hatch <trac@…>

  • Resolution set to worksforme
  • Status changed from new to closed

With the addition of a test suite and reverting local modification to trunk, I am not able to reproduce this issue any longer. If there is independent verification, reopen... otherwise closing as worksforme.

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
to The owner will be changed from cboos. Next status will be 'closed'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.