Skip to content

Commit a23c23f

Browse files
committed
gh-152849: Address review comments
1 parent 453a2bb commit a23c23f

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

Lib/test/test_time.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,10 +1015,13 @@ def test_FromSecondsObject(self):
10151015

10161016
def test_FromSecondsObject_float_overflow_message(self):
10171017
# Float path must report a PyTime_t overflow, like the integer path.
1018+
from _testcapi import PyTime_MIN, PyTime_MAX
10181019
from _testinternalcapi import _PyTime_FromSecondsObject
1019-
for value in (2.0 ** 63, -(2.0 ** 63)):
1020+
for value in (float(PyTime_MAX), float(PyTime_MIN)):
10201021
for time_rnd, _ in ROUNDING_MODES:
1021-
with self.assertRaisesRegex(OverflowError, "to C PyTime_t"):
1022+
with self.assertRaisesRegex(
1023+
OverflowError,
1024+
"timestamp out of range for C PyTime_t"):
10221025
_PyTime_FromSecondsObject(value, time_rnd)
10231026

10241027
def test_AsSecondsDouble(self):

Misc/NEWS.d/next/Core_and_Builtins/2026-07-02-13-30-00.gh-issue-152849.K9dRvP.rst renamed to Misc/NEWS.d/next/Library/2026-07-02-13-30-00.gh-issue-152849.K9dRvP.rst

File renamed without changes.

Python/pytime.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ static void
107107
pytime_overflow(void)
108108
{
109109
PyErr_SetString(PyExc_OverflowError,
110-
"timestamp too large to convert to C PyTime_t");
110+
"timestamp out of range for C PyTime_t");
111111
}
112112

113113

0 commit comments

Comments
 (0)