Skip to content

Conversation

charris
Copy link
Member

@charris charris commented Jan 21, 2025

Backport of #28149.

This PR adds graceful error handling for np.format_float_positional when provided pad_left or pad_right arguments are too large.

In such cases, a ValueError exception is raised.
Added tests and updated the doc to describe limits on pad_left and pad_right

fixes #28068

  • TST: Added tests for correct handling of overflow

  • BUG: fixed pad_left and pad_right causing overflow if too large

  • TST: added overflow test and fixed formatting

  • BUG: fixed overflow checks and simplified error handling

  • BUG: rewritten excpetion message and fixed overflow check

  • TST: split test into smaller tests, added large input value

  • Apply suggestions from code review


This PR adds graceful error handling for np.format_float_positional  when provided pad_left or pad_right arguments are too large.

* TST: Added tests for correct handling of overflow

* BUG: fixed pad_left and pad_right causing overflow if too large

* TST: added overflow test and fixed formatting

* BUG: fixed overflow checks and simplified error handling

* BUG: rewritten excpetion message and fixed overflow check

* TST: split test into smaller tests, added large input value

* Apply suggestions from code review

---------

Co-authored-by: Sebastian Berg <[email protected]>
@charris charris added 00 - Bug 08 - Backport Used to tag backport PRs labels Jan 21, 2025
@charris charris added this to the 2.2.3 release milestone Jan 21, 2025
@charris charris merged commit 5c12602 into numpy:maintenance/2.2.x Jan 21, 2025
68 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
00 - Bug 08 - Backport Used to tag backport PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants