Skip to content

Commit e088274

Browse files
gh-138779: Use the dev_t converter for st_rdev
This allows to support device numbers larger than 2**63-1.
1 parent 859aecc commit e088274

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
@@ -2759,7 +2759,7 @@ _pystat_fromstructstat(PyObject *module, STRUCT_STAT *st)
27592759
SET_ITEM(ST_BLOCKS_IDX, PyLong_FromLong((long)st->st_blocks));
27602760
#endif
27612761
#ifdef HAVE_STRUCT_STAT_ST_RDEV
2762-
SET_ITEM(ST_RDEV_IDX, PyLong_FromLong((long)st->st_rdev));
2762+
SET_ITEM(ST_RDEV_IDX, _PyLong_FromDev(st->st_rdev));
27632763
#endif
27642764
#ifdef HAVE_STRUCT_STAT_ST_GEN
27652765
SET_ITEM(ST_GEN_IDX, PyLong_FromLong((long)st->st_gen));

0 commit comments

Comments
 (0)