Repository navigation
Refuse an invalid timeout and align L.document and L.layout - #85
Merged
Merged
Conversation
L.layout's attributes default to None, as every other builder's do. Work: 726
This was referenced Nov 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three places where the Python SDK read or behaved differently from the other four. A negative
timeout, or a NaN, was taken as no limit, and a fraction such as1.5passed the options and failed at the render with a ctypesArgumentError, where PHP and Java take a whole number of seconds and refuse the rest.L.document's second parameter wassections, where the others call itnodes, which shows when it is passed by name. AndL.layouttyped its attributesLayoutAttr | Nonebut gave them no default, soL.layout()failed whereL.section()andL.column()build an empty node.What changes
EngineOptionsraisesValueError("timeout must be a whole number of seconds, 0 for no limit, not -1")for atimeoutthat isn't a whole number from 0, in PHP's words, asmax_memory_mbbelow it already does for its own range. Every engine call takes its options fromEngineOptions, so a render, a stamp, a merge and the invoice calls all get the check. The docstring's:raises:says so.L.document(attrs, nodes): the second parameter isnodes. A call that passedsections=by name needs the new name.L.layout(attrs=None, nodes=None):L.layout()builds an empty layout, asL.section()andL.column()do.How it was checked
test_a_timeout_that_is_not_a_whole_number_from_0_is_refused(for -1, -60, 1.5, NaN,"5"andTrue),test_a_document_takes_its_sections_as_nodes(by position and by name give the same tree) andtest_a_layout_needs_no_attributes.make test-sdk-python: 273 passed.make check-sdk-api: no generated file differs, and all 65 classes match the schema in all five SDKs.Companion PRs: lpdfio/lpdf-js#89 and lpdfio/lpdf-php#89.
Work: 726