https://github.com/python/cpython/commit/4bb33ff1c19ae2fd506a0cd7a07a6c192f20da5b
commit: 4bb33ff1c19ae2fd506a0cd7a07a6c192f20da5b
branch: 3.14
author: Miss Islington (bot) <[email protected]>
committer: kumaraditya303 <[email protected]>
date: 2025-10-08T00:06:55+05:30
summary:

[3.14] gh-138779: Use the dev_t converter for st_rdev (GH-138780) (#138926)

gh-138779: Use the dev_t converter for st_rdev (GH-138780)

This allows to support device numbers larger than 2**63-1.
(cherry picked from commit 43013f72f0aadc5ee428aa5bdf6d949b4e79779a)

Co-authored-by: Serhiy Storchaka <[email protected]>

files:
A Misc/NEWS.d/next/Library/2025-09-11-11-09-28.gh-issue-138779.TNZnLr.rst
M 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
index 00000000000000..d54f21ffb89669
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2025-09-11-11-09-28.gh-issue-138779.TNZnLr.rst
@@ -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.
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index e1576f809fa766..c6bc9c9c50488f 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -2744,7 +2744,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));

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to