[Python-Dev] stat module in C -- what to do with stat.py?

Serhiy Storchaka storchaka at gmail.com
Thu Jun 20 21:16:08 CEST 2013

20.06.13 16:05, Christian Heimes написав(ла):
> 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?

Now with enumerations in the stdlib the stat module constants are 
candidates for flag enumerations. How easy will be implement it on C?

More information about the Python-Dev mailing list