Open
Description
There's code duplication between stat.py
and _stat.c
and a large subset of that is in definitions that are at least in theory platform dependent.
The C file also contains a lot a local fallback definitions of constants, like:
#ifndef S_IROTH
# define S_IROTH 00004
#endif
Some of these are not really useful, e.g.:
#ifndef S_IFDOOR
# define S_IFDOOR 0
#endif
We don't do this in other modules, and these fallback definition make it harder to determine which constants are relevant for the current platform.
Proposal:
- Remove the definition of platform constants from
stat.py
- Remove fallback definitions in
_stat.c
and export only those names that are actually available on platforms - Add explicit tests for those constants that we require to be available on all platforms
The 2nd bullet might break backward compatibility by removing flags on platforms that don't have them (in particular flags like UF_NODUMP
that are likely only available on BSDs).