Skip to content

fix: handle OverflowError in _parse_int and fix parse_float type annotation#588

Closed
fabiocaccamo with Copilot wants to merge 1 commit into
mainfrom
copilot/fix-code-for-review-comments
Closed

fix: handle OverflowError in _parse_int and fix parse_float type annotation#588
fabiocaccamo with Copilot wants to merge 1 commit into
mainfrom
copilot/fix-code-for-review-comments

Conversation

Copilot AI commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Addresses two issues raised in the PR #578 review.

Changes

  • _parse_int – catch OverflowError: The int(float(val)) fallback only caught ValueError. Inputs like "inf" or "1e309" produce float('inf'), and int(inf) raises OverflowError, which would bubble up to callers instead of falling back to the default.

    # before
    except ValueError:
        return None
    # after
    except (ValueError, OverflowError):
        return None
  • parse_float – fix type annotation: The function accepted bool/int via the new isinstance short-circuit but was still annotated val: str. Updated to val: bool | float | int | str.

Checklist before requesting a review

  • I have performed a self-review of my code.
  • I have added tests for the proposed changes.
  • I have run the tests and there are not errors.

@codecov

codecov Bot commented Jul 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.38%. Comparing base (c437b99) to head (66abbe9).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #588   +/-   ##
=======================================
  Coverage   98.38%   98.38%           
=======================================
  Files          64       64           
  Lines        2417     2417           
=======================================
  Hits         2378     2378           
  Misses         39       39           
Flag Coverage Δ
unittests 98.38% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI changed the title [WIP] Fix code based on review comments fix: handle OverflowError in _parse_int and fix parse_float type annotation Jul 7, 2026
Copilot AI requested a review from fabiocaccamo July 7, 2026 14:41
@fabiocaccamo
fabiocaccamo marked this pull request as ready for review July 7, 2026 20:03
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