Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix validation of ints with leading unary minus #1291

Merged
merged 1 commit into from
May 16, 2024

Conversation

RajatRajdeep
Copy link
Contributor

@RajatRajdeep RajatRajdeep commented May 14, 2024

Change Summary

Pydantic throws a validation error when parsing the negative integer strings. Here's the issue pydantic/pydantic#9396.

I updated the strip_leading_zeros function to handle a leading unary minus character, ensuring it does not throw an error if the string begins with a minus sign.

Related issue number

fix pydantic/pydantic#9396

Checklist

  • Unit tests for the changes exist
  • Documentation reflects the changes where applicable
  • Pydantic tests pass with this pydantic-core (except for expected changes)
  • My PR is ready to review, please add a comment including the phrase "please review" to assign reviewers

Selected Reviewer @sydney-runkle

As a beginner in Rust, this is my first attempt at contributing to Pydantic. :)

Selected Reviewer: @samuelcolvin

Copy link

codecov bot commented May 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

📢 Thoughts on this report? Let us know!

Copy link

codspeed-hq bot commented May 14, 2024

CodSpeed Performance Report

Merging #1291 will not alter performance

Comparing RajatRajdeep:fix-9396 (b663ade) with main (aed6844)

Summary

✅ 155 untouched benchmarks

@RajatRajdeep
Copy link
Contributor Author

Please review

Copy link
Contributor

@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 👍

@davidhewitt davidhewitt merged commit 8f5f91a into pydantic:main May 16, 2024
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Exception parsing negative integer strings
3 participants