Skip to content

arc: raise a clear error for a zero or non-finite axis or angle - #2127

Merged
andersonhc merged 2 commits into
py-pdf:masterfrom
RavSinghChandan:arc-size-finite
Nov 7, 2026
Merged

andersonhc merged 2 commits into
py-pdf:masterfrom
RavSinghChandan:arc-size-finite

Conversation

@RavSinghChandan

Copy link
Copy Markdown

pdf.arc(10, 10, 0, 0, 90) raised ZeroDivisionError: float division by zero, and a NaN axis or angle raised ValueError: cannot convert float NaN to integer. solid_arc() is built on arc() and failed the same way.

arc() now raises ValueError: Arc axes must be non-zero finite numbers: ... for a zero, NaN or infinite a/b, and ValueError: Arc angles must be finite numbers: ... for a NaN or infinite start_angle, end_angle or inclination. Negative axes are still accepted as before.

  • A unit test is covering the code added / modified by this PR
  • A mention of the change is present in CHANGELOG.md
  • This PR is ready to be merged

@andersonhc
andersonhc merged commit 8f0a22a into py-pdf:master Nov 7, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants