From 606ac3b6799bb18b150ae402368e076f655a5d61 Mon Sep 17 00:00:00 2001 From: "Bernhard M. Wiedemann" Date: Wed, 23 Apr 2025 15:29:20 +0200 Subject: [PATCH] Fix an issue with year 2038 after 2038-01-19, UNIX timestamps no longer fit into a signed 32-bit int, which caused the test_opener_interface to fail with fiona/_vsiopener.pyx:93: OverflowError note: I only tested that it builds and passes tests. This patch was done while working on reproducible builds for openSUSE. --- fiona/_vsiopener.pyx | 4 ++-- fiona/gdal.pxi | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fiona/_vsiopener.pyx b/fiona/_vsiopener.pyx index 355139bc..c96f24a9 100644 --- a/fiona/_vsiopener.pyx +++ b/fiona/_vsiopener.pyx @@ -519,7 +519,7 @@ class FileContainer(ABC): pass @abstractmethod - def mtime(self, path: str) -> int: + def mtime(self, path: str) -> intmax_t: """Get the mtime of a resource.. Parameters @@ -618,7 +618,7 @@ class _FilesystemContainer(FileContainer): return [item if isinstance(item, str) else item["filename"] for item in self._obj.ls(path)] def mtime(self, path): try: - mtime = int(self._obj.modified(path).timestamp()) + mtime = long(self._obj.modified(path).timestamp()) except NotImplementedError: mtime = 0 return mtime diff --git a/fiona/gdal.pxi b/fiona/gdal.pxi index 9403bb2b..8b88cae6 100644 --- a/fiona/gdal.pxi +++ b/fiona/gdal.pxi @@ -62,7 +62,7 @@ cdef extern from "cpl_vsi.h" nogil: ctypedef struct VSIStatBufL: long st_size long st_mode - int st_mtime + long long st_mtime ctypedef enum VSIRangeStatus: VSI_RANGE_STATUS_UNKNOWN, VSI_RANGE_STATUS_DATA,