Issues

Issue #560 resolved

CPObject.attach_name not properly handling NotImplementedError

Anonymous created an issue

Hi,

I ran into a NotImplementedError while trying to use cpp:type:: that seems to be CPPObject.attach_name's (in sphinx/domains/cpp.py) fault -- it doesn't correctly handle the exception, which according to the docstring for cpp.py's DefExpr.split_owner() (cpp.py, line 148), is what gets raised when the name doesn't support the operation. The following patch made things run again:

{{{ mbolivar@sleepy domains$ diff cpp.py~ cpp.py 797c797,800 < owner, name = name.split_owner()


    try:
        owner, name = name.split_owner()
    except NotImplementedError:
        owner = None

}}}

Full traceback follows: {{{ mbolivar@sleepy ~$ cat /var/folders/wk/wk6dwngzEtinh62BXvSfWU+++TI/-Tmp-/sphinx-err-_C4L2l.log

Sphinx version: 1.0.4

Docutils version: 0.7 release

Jinja2 version: 2.5.2

Traceback (most recent call last): File "/Library/Python/2.6/site-packages/Sphinx-1.0.4-py2.6.egg/sphinx/cmdline.py", line 173, in main app.build(force_all, filenames) File "/Library/Python/2.6/site-packages/Sphinx-1.0.4-py2.6.egg/sphinx/application.py", line 207, in build self.builder.build_update() File "/Library/Python/2.6/site-packages/Sphinx-1.0.4-py2.6.egg/sphinx/builders/init.py", line 198, in build_update 'out of date' % len(to_build)) File "/Library/Python/2.6/site-packages/Sphinx-1.0.4-py2.6.egg/sphinx/builders/init.py", line 218, in build purple, length): File "/Library/Python/2.6/site-packages/Sphinx-1.0.4-py2.6.egg/sphinx/builders/init.py", line 120, in status_iterator for item in iterable: File "/Library/Python/2.6/site-packages/Sphinx-1.0.4-py2.6.egg/sphinx/environment.py", line 515, in update_generator self.read_doc(docname, app=app) File "/Library/Python/2.6/site-packages/Sphinx-1.0.4-py2.6.egg/sphinx/environment.py", line 655, in read_doc pub.publish() File "/Library/Python/2.6/site-packages/docutils-0.7-py2.6.egg/docutils/core.py", line 203, in publish self.settings) File "/Library/Python/2.6/site-packages/docutils-0.7-py2.6.egg/docutils/readers/init.py", line 69, in read self.parse() File "/Library/Python/2.6/site-packages/docutils-0.7-py2.6.egg/docutils/readers/init.py", line 75, in parse self.parser.parse(self.input, document) File "/Library/Python/2.6/site-packages/docutils-0.7-py2.6.egg/docutils/parsers/rst/init.py", line 157, in parse self.statemachine.run(inputlines, document, inliner=self.inliner) File "/Library/Python/2.6/site-packages/docutils-0.7-py2.6.egg/docutils/parsers/rst/states.py", line 170, in run input_source=document['source']) File "/Library/Python/2.6/site-packages/docutils-0.7-py2.6.egg/docutils/statemachine.py", line 233, in run context, state, transitions) File "/Library/Python/2.6/site-packages/docutils-0.7-py2.6.egg/docutils/statemachine.py", line 454, in check_line return method(match, context, next_state) File "/Library/Python/2.6/site-packages/docutils-0.7-py2.6.egg/docutils/parsers/rst/states.py", line 2706, in underline self.section(title, source, style, lineno - 1, messages) File "/Library/Python/2.6/site-packages/docutils-0.7-py2.6.egg/docutils/parsers/rst/states.py", line 329, in section self.new_subsection(title, lineno, messages) File "/Library/Python/2.6/site-packages/docutils-0.7-py2.6.egg/docutils/parsers/rst/states.py", line 398, in new_subsection node=section_node, match_titles=1) File "/Library/Python/2.6/site-packages/docutils-0.7-py2.6.egg/docutils/parsers/rst/states.py", line 284, in nested_parse node=node, match_titles=match_titles) File "/Library/Python/2.6/site-packages/docutils-0.7-py2.6.egg/docutils/parsers/rst/states.py", line 195, in run results = StateMachineWS.run(self, input_lines, input_offset) File "/Library/Python/2.6/site-packages/docutils-0.7-py2.6.egg/docutils/statemachine.py", line 233, in run context, state, transitions) File "/Library/Python/2.6/site-packages/docutils-0.7-py2.6.egg/docutils/statemachine.py", line 454, in check_line return method(match, context, next_state) File "/Library/Python/2.6/site-packages/docutils-0.7-py2.6.egg/docutils/parsers/rst/states.py", line 2706, in underline self.section(title, source, style, lineno - 1, messages) File "/Library/Python/2.6/site-packages/docutils-0.7-py2.6.egg/docutils/parsers/rst/states.py", line 329, in section self.new_subsection(title, lineno, messages) File "/Library/Python/2.6/site-packages/docutils-0.7-py2.6.egg/docutils/parsers/rst/states.py", line 398, in new_subsection node=section_node, match_titles=1) File "/Library/Python/2.6/site-packages/docutils-0.7-py2.6.egg/docutils/parsers/rst/states.py", line 284, in nested_parse node=node, match_titles=match_titles) File "/Library/Python/2.6/site-packages/docutils-0.7-py2.6.egg/docutils/parsers/rst/states.py", line 195, in run results = StateMachineWS.run(self, input_lines, input_offset) File "/Library/Python/2.6/site-packages/docutils-0.7-py2.6.egg/docutils/statemachine.py", line 233, in run context, state, transitions) File "/Library/Python/2.6/site-packages/docutils-0.7-py2.6.egg/docutils/statemachine.py", line 454, in check_line return method(match, context, next_state) File "/Library/Python/2.6/site-packages/docutils-0.7-py2.6.egg/docutils/parsers/rst/states.py", line 2283, in explicit_markup self.explicit_list(blank_finish) File "/Library/Python/2.6/site-packages/docutils-0.7-py2.6.egg/docutils/parsers/rst/states.py", line 2314, in explicit_list match_titles=self.state_machine.match_titles) File "/Library/Python/2.6/site-packages/docutils-0.7-py2.6.egg/docutils/parsers/rst/states.py", line 321, in nested_list_parse node=node, match_titles=match_titles) File "/Library/Python/2.6/site-packages/docutils-0.7-py2.6.egg/docutils/parsers/rst/states.py", line 195, in run results = StateMachineWS.run(self, input_lines, input_offset) File "/Library/Python/2.6/site-packages/docutils-0.7-py2.6.egg/docutils/statemachine.py", line 233, in run context, state, transitions) File "/Library/Python/2.6/site-packages/docutils-0.7-py2.6.egg/docutils/statemachine.py", line 454, in check_line return method(match, context, next_state) File "/Library/Python/2.6/site-packages/docutils-0.7-py2.6.egg/docutils/parsers/rst/states.py", line 2587, in explicit_markup nodelist, blank_finish = self.explicit_construct(match) File "/Library/Python/2.6/site-packages/docutils-0.7-py2.6.egg/docutils/parsers/rst/states.py", line 2293, in explicit_construct return method(self, expmatch) File "/Library/Python/2.6/site-packages/docutils-0.7-py2.6.egg/docutils/parsers/rst/states.py", line 2035, in directive directive_class, match, type_name, option_presets) File "/Library/Python/2.6/site-packages/docutils-0.7-py2.6.egg/docutils/parsers/rst/states.py", line 2086, in run_directive result = directive_instance.run() File "/Library/Python/2.6/site-packages/Sphinx-1.0.4-py2.6.egg/sphinx/domains/init.py", line 191, in run return BaseDirective.run(self) File "/Library/Python/2.6/site-packages/Sphinx-1.0.4-py2.6.egg/sphinx/directives/init.py", line 146, in run name = self.handle_signature(sig, signode) File "/Library/Python/2.6/site-packages/Sphinx-1.0.4-py2.6.egg/sphinx/domains/cpp.py", line 866, in handle_signature self.describe_signature(signode, rv) File "/Library/Python/2.6/site-packages/Sphinx-1.0.4-py2.6.egg/sphinx/domains/cpp.py", line 905, in describe_signature self.attach_name(signode, obj.name) File "/Library/Python/2.6/site-packages/Sphinx-1.0.4-py2.6.egg/sphinx/domains/cpp.py", line 797, in attach_name owner, name = name.split_owner() File "/Library/Python/2.6/site-packages/Sphinx-1.0.4-py2.6.egg/sphinx/domains/cpp.py", line 154, in split_owner raise NotImplementedError()

}}}

Best,

Marti Bolivar

mbolivar@leaflabs.com

Comments (3)

  1. Log in to comment