Skip to content

Commit c5c1919

Browse files
committed
Auto merge of #125004 - pymongo:issue-125002, r=estebank
Fix println! ICE when parsing percent prefix number This PR fixes #125002 ICE occurring, for example, with `println!("%100000", 1)` or `println!("% 100000", 1)`. ## Test Case/Change Explanation The return type of `Num::from_str` has been changed to `Option<Self>` to handle errors when parsing large integers fails. 1. The first `println!` in the test case covers the change of the first `Num::from_str` usage in `format_foreign.rs:426`. 2. The second `println!` in the test case covers the change of the second `Num::from_str` usage in line 460. 3. The 3rd to 5th `Num::from_str` usages behave the same as before. The 3rd usage would cause an ICE when `num > u16::MAX` in the previous version, but this commit does not include a fix for the ICE in `println!("{:100000$}")`. I think we need to emit an error in the compiler and have more discussion in another issue/PR.
2 parents 3ad18f7 + 6f5c799 commit c5c1919

File tree

0 file changed

+0
-0
lines changed

    0 file changed

    +0
    -0
    lines changed

    0 commit comments

    Comments
     (0)