Thread View: linux.debian.bugs.dist
1 messages
1 total messages
Started by Mathis Faivre
Tue, 10 Nov 2026 10:10
Bug#1141352: python3-debian: merge_fields can raise ValueError
Author: Mathis Faivre
Date: Tue, 10 Nov 2026 10:10
Date: Tue, 10 Nov 2026 10:10
36 lines
4294 bytes
4294 bytes
Thanks, that shape works for me. I am dropping the small fix (1): it unfolded both values as soon as one side was on a single line, so a short value merged with a Description-style one turned into a sorted bag of words with no error. Without a type that case cannot be told apart from a folded field. (2) comes as separate MRs. The first one is ready: - A FieldType enum (SIMPLE, FOLDED, MULTILINE) and a small FieldMeta dataclass holding it, with field_type = None meaning "unknown, keep today's behaviour". - Deb822.field_meta: a case-insensitive mapping, built on first use per instance from a class default that is empty on Deb822. Looking up a field that is not declared creates an empty entry, so your example works for custom fields, and iter_paragraphs over a Packages file does not pay for it. - merge_fields follows the type: FOLDED values are unfolded and merged as a list, MULTILINE merges lines and refuses a single-line value, SIMPLE refuses a multi-line value. A field with no type behaves as today, including the ValueError. - Changes, Dsc (hence Sources) and BuildInfo declare Binary as FOLDED. Deb822 itself declares nothing. As a result Colin's test on a plain Deb822 only passes once the field is typed, which I did in the test. Next MR: folding on dump in Deb822._dump_format, driven by field_meta. Only FOLDED fields, only over 980 characters, at the last blank like dpkg-genchanges. Already folded short values are written back as they are. _multivalued_fields and _relationship_fields stay out for now; FieldMeta leaves room to absorb them later. One place where I plan to differ from what you wrote: you said Deb822ParagraphElement needs similar support for its dump. Its dump concatenates the tokens and gives the file back byte for byte, and folding there would rewrite fields the caller never touched. I plan to fold when the value is set (__setitem__, set_field_to_simple_value, and a folding formatter for the list views) and leave dump exact. Tell me if you would rather have it in dump.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads