[Python-ideas] PEP: Extended stat_result (First Draft)

random832 at fastmail.us random832 at fastmail.us
Tue May 7 06:09:14 CEST 2013


On Mon, May 6, 2013, at 21:19, Andrew Barnert wrote:
> But fixing that requires just a one-line comment saying something like,
> "These values are not standardized, they just happen to work on every
> platform this version of this module is used with."

On the subject of platforms they _don't_ work with... What happens to
code that hardcodes values like 0o644 on such platforms? I suspect there
is more code than there otherwise would have been due to these constants
not being in the os module where stat, open, mkdir, and chmod live (and
it doesn't break on the author's system).

os.open and os.mkdir are even documented as having a default value of
0o777, not stat.S_IRWXU|stat.S_IRWXG|stat.S_IRWXO.

Also, a browse of the Infozip source code shows that on Amiga and THEOS,
there are mode bits that are uncomfortably close enough to POSIX (in
their names, not their values) that it would make sense to include them
in the stat module, but don't use the same model with r/w/x
user/group/other. I bring this up because it looks like the Amiga
version of Python 2.3 actually does a mapping to unix values (i.e. to
the specific concrete values we are discussing)

Can anyone give an example of a POSIX platform where these values don't
work? I swear I remember reading about one but don't remember what it
was.



More information about the Python-ideas mailing list