Skip to content

Commit dbe5e39

Browse files
[3.13] pythongh-138779: Use the dev_t converter for st_rdev (pythonGH-138780) (pythonGH-138927)
This allows to support device numbers larger than 2**63-1. (cherry picked from commit 43013f7) Co-authored-by: Serhiy Storchaka <[email protected]>
1 parent 7160f9f commit dbe5e39

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Support device numbers larger than ``2**63-1`` for the
2+
:attr:`~os.stat_result.st_rdev` field of the :class:`os.stat_result`
3+
structure.

Modules/posixmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2666,7 +2666,7 @@ _pystat_fromstructstat(PyObject *module, STRUCT_STAT *st)
26662666
SET_ITEM(ST_BLOCKS_IDX, PyLong_FromLong((long)st->st_blocks));
26672667
#endif
26682668
#ifdef HAVE_STRUCT_STAT_ST_RDEV
2669-
SET_ITEM(ST_RDEV_IDX, PyLong_FromLong((long)st->st_rdev));
2669+
SET_ITEM(ST_RDEV_IDX, _PyLong_FromDev(st->st_rdev));
26702670
#endif
26712671
#ifdef HAVE_STRUCT_STAT_ST_GEN
26722672
SET_ITEM(ST_GEN_IDX, PyLong_FromLong((long)st->st_gen));

0 commit comments

Comments
 (0)