Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AssertionError in visit_friendclass #616

Closed
zyp opened this issue Jan 3, 2021 · 5 comments · Fixed by #618
Closed

AssertionError in visit_friendclass #616

zyp opened this issue Jan 3, 2021 · 5 comments · Fixed by #618
Assignees
Labels
code Source code

Comments

@zyp
Copy link

zyp commented Jan 3, 2021

Hi, I'm getting an AssertionError in visit_friendclass:

Running Sphinx v3.4.1
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 1 source files that are out of date
updating environment: [new config] 1 added, 0 changed, 0 removed
reading sources... [100%] index                                                                                                                                                                                                                                                
Exception occurred:
  File "/usr/local/lib/python3.8/site-packages/breathe/renderer/sphinxrenderer.py", line 1786, in visit_friendclass
    assert typ in ("friend class", "friend struct")
AssertionError
The full traceback has been saved in /var/folders/zf/y4pvt7_91q711b7ds77ysnt00000gn/T/sphinx-err-c9k68fg9.log, if you want to report the issue to the developers.
Please also report this if it was a user error, so that a better error message can be provided next time.
A bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!

I checked the value of typ before the assertion and it reads simply class. Adding the following two lines to prepend friend if not already present appears to solve/work around the problem:

        typ = ''.join(n.astext() for n in self.render(node.get_type()))  # type: ignore
+       if 'friend' not in typ:
+           typ = 'friend ' + typ
        assert typ in ("friend class", "friend struct")
  • Sphinx 3.4.1
  • Breathe 4.25.1
  • Doxygen 1.9.0

Here's a simple example to reproduce the problem: breathe_friend_error_test.tar.gz

@zyp
Copy link
Author

zyp commented Jan 3, 2021

If I may, what version of doxygen are you using? I'm having some friend problems with doxygen 1.9 and I'm curious if you're having a similar problem.

Originally posted by @awsteiner in #613 (comment)

Are you having the same problem as me? My problem looks unrelated to #613.

@awsteiner
Copy link

Yes I am indeed exactly having the same problem. It appeared when I upgraded doxygen, but I wasn't sure if it was a sphinx issue, a breathe issue, or a doxygen issue. I just used the preprocessor to make sure doxygen ignored the friend declarations, but I'll see if I can try your solution this week some time...

@jakobandersen
Copy link
Collaborator

The assert is a sanity check so while the suggested change may work it doesn't feel like the right fix. Unfortunately I can't reproduce the problem locally. Can you upload an archive of the XML folder?

@zyp
Copy link
Author

zyp commented Jan 7, 2021

Sure, here you go:

doxygen_xml.tar.gz

@jakobandersen
Copy link
Collaborator

I messed up my Doxygen compilation and it is indeed a problem starting from Doxygen 1.9. Apparently the XML output has changed. See PR #618 for the diff for your example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code Source code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants