Repository navigation
Conversation
FanWu-ai
marked this pull request as ready for review
October 5, 2026 05:46
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this change
Keep
pyfloat(right_digits=0, positive=True)integer-valued when a zero draw needs to be made positive.What was wrong
The fallback added
sys.float_info.epsilon, producing2.220446049250313e-16despite the requested zero fractional digits. For example,Faker.seed(31)followed byFaker().pyfloat(left_digits=1, right_digits=0, positive=True)reproduces it.This is the remaining zero-digit case of the precision problem reported in #1402 and addressed for nonzero fractional precision in #1406. #428 established that
right_digits=0generates integer values represented as floats.How this fixes it
Use
1.0, the smallest positive integer-valued float, for this fallback. Positive fractional-precision handling and nonzero results are unchanged. Four deterministic regression cases cover one/two integer digits and both unrestricted andmax_value=1calls.Validation
tox -e flake8,isort,mypy,doc8,checkmanifest,black,py312passed.make lintunder CPython 3.11.16 passed, including stub generation; no generated-file changes remain.python scripts/check_test_class_order.pyandgit diff --checkpassed.AI Assistance Disclosure (REQUIRED)
OpenAI Codex was used for source inspection, implementation, regression tests, independent AI review, and this description. The exact model version is unavailable in this session. All stated checks were actually executed. No human review is claimed. This is a correctness fix, with no vulnerability or exploit claim.
Checklist
make lint.