Repository navigation
Preserve Windows time conversion error classes - #9022
Conversation
Require OSError with EINVAL for representable timestamps rejected by the Windows C runtime, while preserving OverflowError for float(2**63). This initial regression-only commit intentionally exposes the current Windows error mapping before the implementation follows. AI assistance covered source comparison, regression design, and automated Linux baseline/reference controls. Native Windows results are pending. No human validation is claimed. Assisted-by: Codex:model-version-unavailable
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
📒 Files selected for processing (5)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
The first hosted regression run failed on CPython 3.14.7 as well as RustPython because a presumed-invalid CRT timestamp succeeded. Add bounded diagnostics before the unchanged assertions to capture full version/build metadata and every conversion result, including negative half-day controls. No implementation or canonical test changes are included. The existing time snippet still passes the repository pytest runner on Linux CPython 3.14.7 and the current RustPython baseline. Native diagnostic results remain pending. Assisted-by: Codex:model-version-unavailable
Hosted Windows diagnostics show that CPython 3.14.7 and RustPython both accept gmtime(-1) and gmtime(-43200), while -86400 is rejected by all three converters. Correct only the newly added shared negative test value. CPython raises OSError(errno 22) for every selected rejected value, while the RustPython baseline raises OverflowError. Canonical tests and the recorded diagnostics remain unchanged. The existing snippet passes both Linux reference and baseline controls. Assisted source investigation and automated verification used no manual validation. Assisted-by: Codex:model-version-unavailable
Return CRT errno failures from the Windows calendar helpers and translate them to Python OSError. Adapt the datetime caller while retaining its Unix behavior. Use an exclusive signed float upper bound so float(2**63) still raises OverflowError before reaching the CRT. Keep Windows negative-time FILETIME fallback and time64 ABI changes outside this Python 3.14 extraction. Existing datetime local-error coverage is retained and a UTC error control is added for the observed rejected timestamp -86400. Hosted native diagnostics prove CPython 3.14.7 raises OSError(errno 22) where the baseline raises OverflowError. Windows-GNU host_env check and warnings-denied Clippy pass. Selected canonical datetime and complete time/datetime snippet Linux controls pass, with six existing baseline canonical skips. Fixed native Windows verification remains pending CI. AI assistance covered source comparison, implementation, regression design, and automated verification. No manual validation is claimed. Assisted-by: Codex:model-version-unavailable
Merging this PR will not alter performance
Comparing Footnotes
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dfd1eedc70
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| try: | ||
| converter(timestamp) | ||
| except OSError as error: | ||
| assert error.errno == errno.EINVAL, (converter, timestamp, error) |
There was a problem hiding this comment.
Remove prohibited test logic additions
This adds new assertion/control flow and timestamp data to extra_tests/snippets/stdlib_time.py (and the same commit adds another case to stdlib_datetime.py), but the root policy explicitly forbids changes to test assertions, logic, or data and limits accepted test-file edits to expected-failure decorator changes. Remove these additions (or revise the repository policy first) rather than landing them in the test files.
AGENTS.md reference: AGENTS.md:L273-L279
Useful? React with 👍 / 👎.
Scope
Preserve Python 3.14's exception classes for Windows
time.gmtime(),time.localtime(), andtime.ctime()conversions.This draft deliberately starts with a regression-only commit. Its Windows RustPython snippet is expected to fail on the current baseline, which converts UCRT failures to
OverflowError. The existing hosted Windows workflow will establish the native baseline before the implementation is added to this same draft branch. Implementation and verification will remain visible in the commit history and checks.Expected behavior
time_tbut rejected by the Windows C runtime raisesOSErrorwitherrno.EINVAL, including -1 and 2**40.float(2**63)remains anOverflowErrorbefore the OS conversion. The fix must use an exclusive upper bound because signedtime_t's maximum rounds up as a float.Evidence at draft creation
localtime_s/gmtime_sfailures withPyExc_OSError.This is a narrow Python 3.14 compatibility extraction from #8954.
AI assistance: OpenAI Codex assisted with source comparison, regression design, implementation preparation, and automated verification under the user's direction. No manual Windows validation is claimed.