Align os.utime float-to-duration rounding with CPython semantics#6501
Align os.utime float-to-duration rounding with CPython semantics#6501
Conversation
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the Comment |
Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>
Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>
Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>
Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>
Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>
Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>
Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>
Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>
Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>
Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>
|
@copilot Why doesn't this patch affect the tests? Does it mean using Ok(Self::from_secs_f64(f)) is also fine and we don't need to implement rounding? |
The existing tests don’t hit the rounding edge where Rust 1.63’s |
|
Okay, then we don't have to fix this |
os.utimefloat inputs regressed due to RustDuration::from_secs_f64rounding changes; CPython floors times toward -∞. This patch restores CPython-equivalent flooring to keeptest_utime_by_indexed/timespassing.Duration::from_secs_f64with explicit nanosecond flooring, sign/finite checks, and bounds enforcement against the max(u64 seconds, <1e9 ns)duration._PyTime_DoubleToDenominatorforos.utimepaths while preserving integer handling.Example:
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.