Skip to content

Jules - improve wrapping of -ve page numbers - #5248

Merged
julian-smith-artifex-com merged 2 commits into
mainfrom
jules
Nov 3, 2026
Merged

julian-smith-artifex-com merged 2 commits into
mainfrom
jules

Conversation

@julian-smith-artifex-com

Copy link
Copy Markdown
Collaborator

…f a loop.

If x is negative, then `x % n` is equivalent to `while x < 0: x += n`.
@julian-smith-artifex-com
julian-smith-artifex-com merged commit 3ddef9d into main Nov 3, 2026
3 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 3, 2026
@JorjMcKie

Copy link
Copy Markdown
Collaborator

Question: why do we need if start < 0: at all? start %= 360 will always deliver a value in the range [0, 360), no matter what the initial start is. Saves the value check.

@julian-smith-artifex-com

Copy link
Copy Markdown
Collaborator Author

This would change the behaviour of out-of-range +ve values - at the moment these are errors.

There's a benefit to wrapping -ve values (e.g. -1 for last item is convenient). But there is not a corresponding benefit for accepting out-of-range +ve values, and i think such values are likely to be a mistake that we should not hide.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document.delete_pages() raises ValueError: bad page number(s) on negative page numbers passed as two positional arguments

2 participants