[Python-Dev] stat module in C -- what to do with stat.py?
Christian Heimes
christian at python.org
Thu Jun 20 15:05:34 CEST 2013
Hello,
I have re-implemented the entire stat module in C. [1] It's a necessary
step to fix portability issues. For most constants POSIX standards
dictate only the name of the constant and its meaning but not its value.
Only the values of permission bits (0644 == rw-r--r--) have fixed values.
For example S_IFDIR is usually 0o40000 but it might be 0o20000 on some
platforms. Common file types seem to have the same value on all
important platforms. It's the only reason we were able to get away with
stat.py. But uncommon file types like door, event port and whiteout
don't have sensible default values. The C implementation is able to pick
up the platform's values easily.
What shall I do about stat.py? statmodule.c implements all features of
stat.py so there is no point in using it in CPython. It's one Python
file less to load on every startup. However it might still be useful to
alternative implementations of Python such as Jython or PyPy.
1) keep the file stat.py but let it be shadowed by the builtin stat
module. Antoine loathes my hack...
2) rename stat.py to _stat.py
3) remove stat.py
Opinions?
Christian
[1] http://bugs.python.org/issue11016
More information about the Python-Dev
mailing list