]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-83714: Fix a compiler warning in stat_nanosecond_timestamp() (#141043)
authorVictor Stinner <vstinner@python.org>
Wed, 5 Nov 2025 17:31:35 +0000 (18:31 +0100)
committerGitHub <noreply@github.com>
Wed, 5 Nov 2025 17:31:35 +0000 (18:31 +0100)
Disable the fast path on systems with 32-bit long.

Modules/posixmodule.c

index 50464b01efba31818a03ee7438e99f9cd1ce3c0b..ecda75ec6ab775bac449be797497280b2755825d 100644 (file)
@@ -2634,11 +2634,14 @@ _posix_free(void *module)
 static PyObject *
 stat_nanosecond_timestamp(_posixstate *state, time_t sec, unsigned long nsec)
 {
+#if SIZEOF_LONG >= 8
     /* 1677-09-21 00:12:44 to 2262-04-11 23:47:15 UTC inclusive */
     if ((LLONG_MIN/SEC_TO_NS) <= sec && sec <= (LLONG_MAX/SEC_TO_NS - 1)) {
         return PyLong_FromLongLong(sec * SEC_TO_NS + nsec);
     }
-    else {
+    else
+#endif
+    {
         PyObject *ns_total = NULL;
         PyObject *s_in_ns = NULL;
         PyObject *s = _PyLong_FromTime_t(sec);