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

Assert in flowable.py - Caused by long class name processed by autodoc #435

Open
1 task done
BobDenny opened this issue Oct 11, 2024 · 6 comments
Open
1 task done
Labels
bug crash rinohtype aborts due to an uncaught exception priority:high

Comments

@BobDenny
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Sphinx or rinoh output

Exception occurred:
  File "C:\Users\rdenn\AppData\Roaming\Python\Python311\site-packages\rinoh\flowable.py", line 297, in flow_inner
    assert container.advance2(padding_border_bottom)
AssertionError

Source files

Too complicated. I'm getting the above exception when processing a large package with API defs processed by autodoc/napoleon. I narrowed it down to this;

def DestinationSideOfPier(self, RightAscension: float, Declination: float) -> PierSide:

which is rendered by autodoc. By changing the DestinationSideOfPier to Yo in that one place, the entire document (loads of classes and property/method defs) renders in Rinoh. I'm a bit overwhelmed by all of the Element Styling info in the manual. I know padding_border_bottom is an element style, and I looked in flowable.py but it's way above my head. It seems that that method name is longer than expected. But there are so many layers to this....

Is this a bug, a limitation, or is there a possible solution that I can implement here?

Versions

rinohtype 0.5.5 (2024-07-13)
Sphinx 7.2.6
Python 3.11.1 (tags/v3.11.1:a7a450f, Dec  6 2022, 19:58:39) [MSC v.1934 64 bit (AMD64)]
Windows-10-10.0.19045-SP0
@BobDenny BobDenny added bug crash rinohtype aborts due to an uncaught exception labels Oct 11, 2024
@BobDenny
Copy link
Author

BobDenny commented Oct 13, 2024

Additional info: It turns out that changing the [VARIABLES] serif_typeface, [default: Paragraph] font_size, or letting them default (comment out) will change where the error occurs (thermometer during rendering), or in some cases allow the document to render successfully. Always the same error though:

assert container.advance2(padding_border_bottom)

I think I need to understand what can set up the condtions for that specific error. I should mention this behavior is identical on Debian Linux.

@BobDenny
Copy link
Author

BobDenny commented Oct 13, 2024

So many things trigger this. I unwrapped some lines to prevent multiple spaces in the rendered paragraphs. This caused the same error.

@BobDenny
Copy link
Author

Brecht -- What sort of things can cause this?

Exception occurred:
  File "C:\Users\rdenn\AppData\Roaming\Python\Python311\site-packages\rinoh\flowable.py", line 297, in flow_inner
    assert container.advance2(padding_border_bottom)
AssertionError

@BobDenny
Copy link
Author

This is crazy. I decided to try finding the cause of the assert error in flowable.py, line 297 (assert container.advance2(padding_border_bottom) by simply commenting it out. I thought it might help me understand what was causing rinoh to fail for me. Well, surprise, the problem vanished! I can render my giant document now, change the stylesheet settings, see those effects, etc.

I guess you can close this ticket unless you want to try to find out what conditions cause that assert to fail, and whether the assert being false can actually cause problems in the resulting document. For me, I can't find anything and I have really looked.

@brechtm
Copy link
Owner

brechtm commented Oct 18, 2024

I'm glad you were able to work around the issue, but of course this assert is in place for a reason: this is definitely a bug. I was refactoring the Container.advance function, but didn't yet wrap this up completely. Hence the existence of advance and advance2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug crash rinohtype aborts due to an uncaught exception priority:high
Projects
None yet
Development

No branches or pull requests

3 participants
@brechtm @BobDenny and others