Visitar URL original
gh-99726: Adds os.statx function and associated constants by zooba · Pull Request #99755 · python/cpython · GitHub
Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
6f7e9fa
gh-99726: Adds os.statx function and associated constants
zooba Nov 24, 2022
21b5f50
Update configure
zooba Nov 24, 2022
8fd982e
Fix POSIX build issues
zooba Nov 24, 2022
2b85372
Revert unrelated pyconfig.h.in changes
zooba Nov 24, 2022
a813f84
Revert generated files
zooba Nov 24, 2022
5a6ce8e
Update pyconfig.h.in
zooba Nov 24, 2022
6f54522
Fixup configure
zooba Nov 24, 2022
cda6886
Fix docs
zooba Nov 24, 2022
0db9341
Check for STATX_MNT_ID
zooba Nov 24, 2022
e278102
Properly exclude statx
zooba Nov 24, 2022
7844111
Add missing fields
zooba Nov 24, 2022
a787ae7
More field initialization
zooba Nov 24, 2022
b1182c3
More uninitialised fields
zooba Nov 24, 2022
cc5a159
endif
zooba Nov 24, 2022
ce24e79
Switch to less-confusing conditional attributes. Other fixes
zooba Nov 25, 2022
4a6e5ee
Few fixes
zooba Nov 25, 2022
7835bde
Make init config tests more reliable on Windows builds
zooba Nov 25, 2022
64111f4
Merge remote-tracking branch 'cpython/main' into gh-99726
zooba Nov 25, 2022
d53c013
Merge remote-tracking branch 'cpython/main' into gh-99726
zooba Nov 28, 2022
991876d
Update DeviceType check and rest of stdlib
zooba Nov 28, 2022
2d90f4d
Fix refleak and tests
zooba Nov 28, 2022
a6d3386
More test fixes
zooba Nov 28, 2022
ed5f370
Fix os.statx assumption
zooba Nov 28, 2022
4e95220
Documentation improvements
zooba Nov 29, 2022
3cc69aa
Missed one doc change
zooba Nov 29, 2022
025a4e6
Nope, it was applied fine
zooba Nov 29, 2022
8ee94aa
Handle block devices better
zooba Nov 29, 2022
bbcc6ee
Put statx in correct os sets, and include in pythoninfo
zooba Nov 29, 2022
768ba42
Merge remote-tracking branch 'cpython/main' into gh-99726
zooba Dec 5, 2022
cadeecb
Merge branch 'main' into gh-99726
carljm Dec 15, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
More uninitialised fields
  • Loading branch information
zooba committed Nov 24, 2022
commit b1182c3e9079be599a73d8b8dba735147cbc3831
19 changes: 16 additions & 3 deletions Modules/posixmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -2514,14 +2514,14 @@ _pystat_fromstructstat(PyObject *module, STRUCT_STAT *st, unsigned int stx_mask)
#endif
#endif
val = PyFloat_FromDouble(bsec + 1e-9*bnsec);
PyStructSequence_SET_ITEM(v, ST_BIRTHTIME_IDX,
val);
PyStructSequence_SET_ITEM(v, ST_BIRTHTIME_IDX, val);
}
#endif
#ifdef HAVE_STRUCT_STAT_ST_FLAGS
PyStructSequence_SET_ITEM(v, ST_FLAGS_IDX,
PyLong_FromLong((long)st->st_flags));
#endif
#endif
#ifdef HAVE_STRUCT_STAT_ST_FILE_ATTRIBUTES
PyStructSequence_SET_ITEM(v, ST_FILE_ATTRIBUTES_IDX,
PyLong_FromUnsignedLong(st->st_file_attributes));
Expand All @@ -2542,11 +2542,24 @@ _pystat_fromstructstat(PyObject *module, STRUCT_STAT *st, unsigned int stx_mask)
PyLong_FromUnsignedLong(stx_mask));

#ifdef HAVE_STATX
/* ensure unused fields that are present for statx are initialized */
PyStructSequence_SET_ITEM(v, STX_ATTRIBUTES_IDX, PyLong_FromLong(0));
PyStructSequence_SET_ITEM(v, STX_ATTRIBUTES_MASK_IDX, PyLong_FromLong(0));
#ifdef STATX_MNT_ID
PyStructSequence_SET_ITEM(v, STX_MNT_ID_IDX, PyLong_FromLong(0));
#endif
#ifndef HAVE_STRUCT_STAT_ST_BLKSIZE
PyStructSequence_SET_ITEM(v, ST_BLKSIZE_IDX, PyLong_FromLong(0));
#endif
#ifndef HAVE_STRUCT_STAT_ST_BLOCKS
PyStructSequence_SET_ITEM(v, ST_BLOCKS_IDX, PyLong_FromLong(0));
#endif
#ifndef HAVE_STRUCT_STAT_ST_RDEV
PyStructSequence_SET_ITEM(v, ST_RDEV_IDX, PyLong_FromLong(0));
#endif
#ifndef HAVE_STRUCT_STAT_ST_FLAGS
PyStructSequence_SET_ITEM(v, ST_FLAGS_IDX, PyLong_FromLong(0));
#endif
#endif

if (PyErr_Occurred()) {
Expand Down Expand Up @@ -2615,7 +2628,7 @@ _pystat_fromstructstatx(PyObject *module, struct statx *st)
PyLong_FromUnsignedLongLong(st->stx_mnt_id));
#endif


/* ensure unused fields that are present for regular stat are initialized */
#ifdef HAVE_STRUCT_STAT_ST_FLAGS
PyStructSequence_SET_ITEM(v, ST_FLAGS_IDX, PyLong_FromLong(0));
#endif
Expand Down