Bug report
Bug description:
Documented behaviour: Python datetime documentation, date Objects, date(year, month, day): "If an argument outside those ranges is given, ValueError is raised." The listed year range is "MINYEAR <= year <= MAXYEAR".
Expected: ValueError for date(-(1 << 100), 1, 1).
Actual: OverflowError.
import datetime
args = (-(1 << 100), 1, 1)
y, m, d = args
if not all(type(x) is int for x in args) or (m, d) != (1, 1):
print("REFUTATION REJECTED:", "invalid argument types or month/day")
elif datetime.MINYEAR <= y <= datetime.MAXYEAR:
print("REFUTATION REJECTED:", "year is within the documented range")
else:
expected = ("exception", "ValueError")
try:
result = datetime.date(*args)
actual = ("date", (result.year, result.month, result.day))
except Exception as e:
actual = ("exception", type(e).__name__)
if actual != expected:
print("REFUTATION CONFIRMED:", args, actual, expected)
else:
print("REFUTATION REJECTED:", "observed the documented ValueError")
Output on Python 3.14.6 (Windows-11-10.0.26220-SP0), standard library datetime:
REFUTATION CONFIRMED: (-1267650600228229401496703205376, 1, 1) ('exception', 'OverflowError') ('exception', 'ValueError')
This report was found and written by an automated property-testing tool I run (bugforge). The reproducer above was executed and its output is pasted unedited; no person reviewed the report before it was filed. The search script is in https://github.com/augusto-rehfeldt/bugforge-results/tree/main/datetime-20261003-014717-c1
CPython versions tested on:
3.14
Operating systems tested on:
Windows
Bug report
Bug description:
Documented behaviour: Python datetime documentation, date Objects, date(year, month, day): "If an argument outside those ranges is given, ValueError is raised." The listed year range is "MINYEAR <= year <= MAXYEAR".
Expected: ValueError for date(-(1 << 100), 1, 1).
Actual: OverflowError.
Output on Python 3.14.6 (Windows-11-10.0.26220-SP0), standard library
datetime:This report was found and written by an automated property-testing tool I run (bugforge). The reproducer above was executed and its output is pasted unedited; no person reviewed the report before it was filed. The search script is in https://github.com/augusto-rehfeldt/bugforge-results/tree/main/datetime-20261003-014717-c1
CPython versions tested on:
3.14
Operating systems tested on:
Windows