3715: markdown_utils.py line 241, in iter_markdown_lines i += 1 TypeError: unsupported operand type(s) for +=: 'instance' and 'int'

mam****@gmai***** (Google Code) (Is this you? Claim this profile.)
david
david
Jan. 13, 2015
3765
What version are you running?
2.0.12

What's the URL of the page containing the problem?
https://bld-rb01.cisco.com/r/13072/

What steps will reproduce the problem?
1. Not sure - the screen is just crashing after upgrade.
2.
3.

What is the expected output? What do you see instead?
The screen should not crash.

What operating system are you using? What browser?
Red Hat Linux 5.5 server and Google Chrome browser.

Please provide any additional information below.

2015-01-12 15:33:50,719 - ERROR -  - Exception thrown for user mamiles at https://bld-rb01.cisco.com/r/13072/

unsupported operand type(s) for +=: 'instance' and 'int'
Traceback (most recent call last):
  File "/local/ichnaea_conf/site/python_ve/reviewboard_v2.0/lib/python2.7/site-packages/Django-1.6.9-py2.7.egg/django/core/handlers/bas
e.py", line 112, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/local/ichnaea_conf/site/python_ve/reviewboard_v2.0/lib/python2.7/site-packages/ReviewBoard-2.0.12-py2.7.egg/reviewboard/accoun
ts/decorators.py", line 21, in _check
    return login_required(view_func)(*args, **kwargs)
  File "/local/ichnaea_conf/site/python_ve/reviewboard_v2.0/lib/python2.7/site-packages/Django-1.6.9-py2.7.egg/django/contrib/auth/deco
rators.py", line 22, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/local/ichnaea_conf/site/python_ve/reviewboard_v2.0/lib/python2.7/site-packages/ReviewBoard-2.0.12-py2.7.egg/reviewboard/site/d
ecorators.py", line 35, in _check
    return view_func(request, local_site=local_site, *args, **kwargs)
  File "/local/ichnaea_conf/site/python_ve/reviewboard_v2.0/lib/python2.7/site-packages/ReviewBoard-2.0.12-py2.7.egg/reviewboard/review
s/views.py", line 663, in review_detail
    changedesc.fields_changed[field_id])
  File "/local/ichnaea_conf/site/python_ve/reviewboard_v2.0/lib/python2.7/site-packages/ReviewBoard-2.0.12-py2.7.egg/reviewboard/reviews/fields.py", line 161, in get_change_entry_sections_html
    'rendered_html': mark_safe(self.render_change_entry_html(info)),
  File "/local/ichnaea_conf/site/python_ve/reviewboard_v2.0/lib/python2.7/site-packages/ReviewBoard-2.0.12-py2.7.egg/reviewboard/reviews/fields.py", line 514, in render_change_entry_html
    new_lines = list(iter_markdown_lines(new_value))
  File "/local/ichnaea_conf/site/python_ve/reviewboard_v2.0/lib/python2.7/site-packages/ReviewBoard-2.0.12-py2.7.egg/reviewboard/reviews/markdown_utils.py", line 241, in iter_markdown_lines
    i += 1
TypeError: unsupported operand type(s) for +=: 'instance' and 'int'
chipx86
#1 chipx86
Hmm, that seems very strange. `i` is never anything but an integer in that code.

We have a support contract with Cisco covering at least some of the servers there. I don't know if this is one of them, but let me reach out to our contact there. We might be able to arrange to get more information on this.
#2 mam****@gmai***** (Google Code) (Is this you? Claim this profile.)
To allow us to see the review in the web GUI I added this code right after the "i += 1" line.


/local/ichnaea_conf/site/python_ve/reviewboard_v2.0/lib/python2.7/site-packages/ReviewBoard-2.0.12-py2.7.egg/reviewboard/reviews
diff markdown_utils.py markdown_utils.py.orig
231,232d230
<                 if not isinstance(i, int):
<                     i = 1

In this review it seems they cut and pasted the all the test cases and the results of each test.  Maybe there was special chars or something in the description.

-Marvin
#3 mam****@gmai***** (Google Code) (Is this you? Claim this profile.)
We made these changes to the code:

diff markdown_utils.py.orig markdown_utils.py
230a231,237
>                 try:
>                     print "next line is out i"
>                     print i, i.name, i.value
>                     i = int(i.value)
>                 except:
>                     print "we went to except"
>                     i = 1

This is the output when we access this review.

[Mon Jan 12 21:42:20 2015] [error] next line is out i
[Mon Jan 12 21:42:20 2015] [error] <xml.dom.minidom.Attr instance at 0x2af3e15be9e0> start 2
[Mon Jan 12 21:42:20 2015] [error] next line is out i
[Mon Jan 12 21:42:20 2015] [error] <xml.dom.minidom.Attr instance at 0x2af3e16346c8> start 10
[Mon Jan 12 21:42:20 2015] [error] next line is out i
[Mon Jan 12 21:42:20 2015] [error] <xml.dom.minidom.Attr instance at 0x2af3e1634f38> start 24
[Mon Jan 12 21:42:20 2015] [error] next line is out i
[Mon Jan 12 21:42:20 2015] [error] <xml.dom.minidom.Attr instance at 0x2af3e18c1560> start 25
[Mon Jan 12 21:42:20 2015] [error] next line is out i
[Mon Jan 12 21:42:20 2015] [error] <xml.dom.minidom.Attr instance at 0x2af3e18d32d8> start 27
[Mon Jan 12 21:42:20 2015] [error] next line is out i
[Mon Jan 12 21:42:20 2015] [error] <xml.dom.minidom.Attr instance at 0x2af3e19040e0> start 26

I hope this helps.

-Marvin 
512-423-3542
david
#4 david
Very helpful, thank you.
  • +Started
  • +david
david
#5 david
Fixed in release-2.0.x (4f11579). Thanks!
  • -Started
    +Fixed
#7 trivia21

Can you please point me to the patch, I need to merge it to RB2.0.12

chipx86
#8 chipx86

You can find this in commit 4f11579.

  • -david
    +david
#9 trivia21

Thanks David.