[3.13] gh-120268: Prohibit passing `None to _pydatetime.date.fromtimestamp` (GH-120269) (GH-120282)

This makes the pure Python implementation consistent with the C implementation.
(cherry picked from commit 34f5ae69fe)

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
This commit is contained in:
Miss Islington (bot) 2024-06-11 11:54:02 +02:00 committed by GitHub
parent f386cc9620
commit 64a61ca13c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 0 deletions

View file

@ -1355,6 +1355,11 @@ class TestDate(HarmlessMixedComparison, unittest.TestCase):
self.assertRaises(OverflowError, self.theclass.fromtimestamp,
insane)
def test_fromtimestamp_with_none_arg(self):
# See gh-120268 for more details
with self.assertRaises(TypeError):
self.theclass.fromtimestamp(None)
def test_today(self):
import time