Pewarta Proxy

📋 Server Request & Proxy Logs

Loading active proxy settings...
Developed by Khairul Adha (adhexa.id)
Mengambil log server...

⚙️ Pengaturan Proxy Target

Skip to content

Preserve float-subclass values in time.sleep conversion - #9292

Merged
youknowone merged 1 commit into
RustPython:mainfrom
youknowdot:split/sleep-float-subclass-315
Oct 22, 2026
Merged

youknowone merged 1 commit into
RustPython:mainfrom
youknowdot:split/sleep-float-subclass-315

Conversation

@youknowdot

Copy link
Copy Markdown
Contributor

Summary

Read the stored value of float instances and subclasses in time.sleep instead of calling an overridden float. This follows CPython 3.15.0 PyFloat_AsDouble behavior. Keep index precedence and the existing non-float conversion path, rounding, range checks, audit ordering and platform sleep implementation unchanged.

A float subclass can currently change whether sleep rejects a negative value by overriding float, or raise an exception that CPython never requests. This narrow native fix extracts that behavior from #8954 without adding an unused PyTime helper module or moving the surrounding conversion code. No Lib changes or new Rust Python-behavior tests.

Validation

Tested base: 43368209c505c8807f5efdf3a39729bb30866722.

  • Source-bound default-features + capi CLI build.
  • Eight bounded external observations using only zero/negative durations: baseline matches CPython in four, candidate matches all eight, including conversion call counts and exception identity.
  • One unchanged AST-selected canonical method, test.test_time.TimeTestCase.test_sleep_exceptions, passes on baseline, candidate and CPython 3.15.0. Its AST matches the pinned canonical source. The class setUp assignment self.t = time.time() was omitted because this method does not use it; the method and assertions are unchanged. This is selected-method evidence, not whole-module coverage.
  • VM threaded/non-threaded checks, strict all-target VM Clippy and changed-file hooks passed.

Full workspace/CAPI runtime suites, release test_time, the whole time test module and positive-duration sleep tests were not run locally. The external observations do not establish cross-platform scheduling behavior or broad PyTime parity.

AI assistance

AI assistance was used for source analysis, implementation and validation preparation.

Follow CPython PyFloat_AsDouble without calling float-subclass overrides.
Keep index precedence and other conversion behavior unchanged.

Assisted-by: OpenAI Codex
@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: Repository: RustPython/RustPython/.coderabbit.yml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 982ab5ac-4806-4ffb-97dc-7d25e0585afa
📥 Commits

Reviewing files that changed from the base of the PR and between 4336820 and 1e58ac3.

📒 Files selected for processing: 1
  • crates/vm/src/stdlib/time.rs
+--------------------------------------------------------------+
| Security by obscurity? I can see right through the curtains. |
+--------------------------------------------------------------+
  \
   \     /)/)
        ( '')
        /  |
      o(___)
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codspeed

codspeed Bot commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 62 untouched benchmarks
⏩ 4 skipped benchmarks1


Comparing youknowdot:split/sleep-float-subclass-315 (1e58ac3) with main (4336820)

Open in CodSpeed

Footnotes

  1. 4 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@youknowone
youknowone marked this pull request as ready for review October 22, 2026 05:50
@youknowone
youknowone merged commit 308085d into RustPython:main Oct 22, 2026
30 of 31 checks passed
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-10-22T05:50:38.389867Z 1e58ac3 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants