-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Align os.utime float-to-duration rounding with CPython semantics #6501
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
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.