]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-138779: Use the dev_t converter for st_rdev (GH-138780) (GH-138927)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 15 Sep 2025 14:29:57 +0000 (16:29 +0200)
committerGitHub <noreply@github.com>
Mon, 15 Sep 2025 14:29:57 +0000 (14:29 +0000)
This allows to support device numbers larger than 2**63-1.
(cherry picked from commit 43013f72f0aadc5ee428aa5bdf6d949b4e79779a)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Misc/NEWS.d/next/Library/2025-09-11-11-09-28.gh-issue-138779.TNZnLr.rst [new file with mode: 0644]
Modules/posixmodule.c

diff --git a/Misc/NEWS.d/next/Library/2025-09-11-11-09-28.gh-issue-138779.TNZnLr.rst b/Misc/NEWS.d/next/Library/2025-09-11-11-09-28.gh-issue-138779.TNZnLr.rst
new file mode 100644 (file)
index 0000000..d54f21f
--- /dev/null
@@ -0,0 +1,3 @@
+Support device numbers larger than ``2**63-1`` for the
+:attr:`~os.stat_result.st_rdev` field of the :class:`os.stat_result`
+structure.
index 90d91c28fd28a44f1903b2c3c23afcd0734f8654..b7d128b81304b07eb5757d39814b7ce581d375d4 100644 (file)
@@ -2666,7 +2666,7 @@ _pystat_fromstructstat(PyObject *module, STRUCT_STAT *st)
     SET_ITEM(ST_BLOCKS_IDX, PyLong_FromLong((long)st->st_blocks));
 #endif
 #ifdef HAVE_STRUCT_STAT_ST_RDEV
-    SET_ITEM(ST_RDEV_IDX, PyLong_FromLong((long)st->st_rdev));
+    SET_ITEM(ST_RDEV_IDX, _PyLong_FromDev(st->st_rdev));
 #endif
 #ifdef HAVE_STRUCT_STAT_ST_GEN
     SET_ITEM(ST_GEN_IDX, PyLong_FromLong((long)st->st_gen));