Skip to content

Align native datetime conversion with Python 3.15 - #9133

Merged
youknowone merged 1 commit into
RustPython:mainfrom
youknowdot:split/datetime-315-native
Oct 15, 2026
Merged

youknowone merged 1 commit into
RustPython:mainfrom
youknowdot:split/datetime-315-native

Conversation

@youknowdot

Copy link
Copy Markdown
Contributor

Summary

  • Prefer __index__ for native date/datetime timestamp conversion; otherwise accept float-convertible values while preserving NaN/range checks and microsecond rounding.
  • Validate ISO timezone hour/minute/second components before combining the offset.
  • Apply final CPython's naive-local fold probe consistently, preserving main's Windows FILETIME support.

Split from #8954. Only crates/stdlib/src/_datetime.rs changes; no Lib, test, dependency, or lockfile changes. Compared against CPython final commit d220409a13b77de7a6c30abe16ea90db01528edc.

Validation

  • Fresh matching narrow release build after cleaning exact workspace packages; threading,stdlib,stdio,importlib,host_env with default features disabled.
  • Seven unchanged, source-hash-checked canonical datetime test methods passed in separate bounded processes: timestamp conversion (including Decimal/Fraction), UTC timestamp conversion, valid/invalid datetime and time ISO offsets, and low-timestamp fold detection. No skips or expected failures.
  • Six direct protocol-order checks passed on both final CPython and the matching RustPython binary: __index__ precedence, index errors without float fallback, and float-only conversion, for date and aware datetime. All use small epoch values.
  • Strict release Clippy passed for stdlib and VM, all targets, with matching explicit narrow features and -D warnings. Test binaries were compiled but not executed.
  • Normal commit hooks passed, including rustfmt, cspell, and merge-conflict checks.

Validation above is bounded Linux coverage. Full datetime/workspace/C-API suites and Windows runtime behavior were not run locally. Hosted CI remains to be checked.

Implementation, source comparison, and validation were assisted by OpenAI Codex.

Assisted-by: OpenAI Codex:model version unavailable

Prefer index conversion for timestamps, accept float-convertible values, validate ISO timezone components, and apply final local fold detection consistently.

Implementation, source comparison, and bounded validation were assisted by OpenAI Codex.

Assisted-by: OpenAI Codex:model version unavailable
@coderabbitai

coderabbitai Bot commented Oct 15, 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: f8bcaa51-2f34-4063-afe7-b0986247c63d
📥 Commits

Reviewing files that changed from the base of the PR and between 3ab5c0c and ac8c18e.

📒 Files selected for processing: 1
  • crates/stdlib/src/_datetime.rs
+----------------------------------------------------------------+
| 'Works on my machine' is not a QA strategy, it's a confession. |
+----------------------------------------------------------------+
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ 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 15, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 62 untouched benchmarks
⏩ 4 skipped benchmarks1


Comparing youknowdot:split/datetime-315-native (ac8c18e) with main (3ab5c0c)

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 15, 2026 06:06
@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 ⚠️ Failed 2026-10-15T06:06:36.185410Z ac8c18e 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.

@youknowone
youknowone merged commit 9c832ee into RustPython:main Oct 15, 2026
31 checks passed
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

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