⚡ Sangsakala Proxy 🏠 Home
Skip to content

Share calendar time argument conversion - #9670

Draft
youknowdot wants to merge 1 commit into
RustPython:mainfrom
youknowdot:upgrade315-calendar-time-conversion
Draft

youknowdot wants to merge 1 commit into
RustPython:mainfrom
youknowdot:upgrade315-calendar-time-conversion

Conversation

@youknowdot

Copy link
Copy Markdown
Contributor

Summary

  • Reuse existing signed time conversion for gmtime, localtime, and ctime, preserving index precedence, callback exceptions, fractional rounding, and timestamp overflow handling.
  • Share ordered calendar-field extraction across mktime, asctime, and strftime. Read tuple storage directly and retain struct_time's hidden timezone fields, including C-string prefixes for embedded NULs.
  • Separate host calendar construction from validation so mktime can normalize fields, while preserving existing public Rust helper signatures through thin wrappers.

Reference: CPython 3.15 calendar tuple conversion.

Validation

  • CPython 3.15 reference probes confirm conversion precedence, callback ordering/errors, int32 boundary behavior, tuple-subclass iterator bypass, and timezone metadata handling.
  • rustfmt --check and git diff --check pass. Independent source review completed.
  • Native RustPython behavior tests, full workspace/C-API suites, and Windows/WASI execution were not run. No clock-setting or other host-mutating API was called.
  • cargo check and strict cargo clippy -- -D warnings cover rustpython-vm, rustpython-host_env, and rustpython-stdlib with rustpython-stdlib/threading (--locked --offline -j1).

Malformed-tuple diagnostics remain generic rather than matching each function's wording exactly. Existing non-Unix calendar fallback limitations are not addressed. The patch changes no tests, snippets, or workflows.

AI assistance: implementation, CPython reference probes, overlap audit, and source review were performed with OpenAI Codex under the directing maintainer's instructions.

Preserve numeric protocols, tuple callback order, and hidden timezone fields across time conversion APIs.

Assisted-by: OpenAI Codex:model version not exposed
@coderabbitai

coderabbitai Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • 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

@codspeed

codspeed Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 62 untouched benchmarks
⏩ 4 skipped benchmarks1


Comparing youknowdot:upgrade315-calendar-time-conversion (cc28025) with main (0b081b0)

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. ↩

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.

1 participant