Files
MINGW-packages/mingw-w64-python/0102-time-fix-strftime-not-raising-for-invalid-year-value.patch
2023-02-10 12:56:41 +01:00

26 lines
1023 B
Diff

From 75a7ee71c4a532faa3afcea8a3de66e46c071cd4 Mon Sep 17 00:00:00 2001
From: Christoph Reiter <reiter.christoph@gmail.com>
Date: Fri, 23 Jul 2021 08:52:50 +0200
Subject: [PATCH 102/N] time: fix strftime not raising for invalid year
values
It's crt specific and not compiler specific.
This fixes a test case in test_time
---
Modules/timemodule.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Modules/timemodule.c b/Modules/timemodule.c
index 4caacc3..4787fa3 100644
--- a/Modules/timemodule.c
+++ b/Modules/timemodule.c
@@ -759,7 +759,7 @@ time_strftime(PyObject *self, PyObject *args)
return NULL;
}
-#if defined(_MSC_VER) || (defined(__sun) && defined(__SVR4)) || defined(_AIX) || defined(__VXWORKS__)
+#if defined(MS_WINDOWS) || (defined(__sun) && defined(__SVR4)) || defined(_AIX) || defined(__VXWORKS__)
if (buf.tm_year + 1900 < 1 || 9999 < buf.tm_year + 1900) {
PyErr_SetString(PyExc_ValueError,
"strftime() requires year in [1; 9999]");