[Python-Dev] Compiling the source without stat

"Martin v. Löwis" martin at v.loewis.de
Wed Dec 14 20:51:15 CET 2011

> It's 99% definite that I can't compile further without touching the
> source code. I have to #define my own PYOS_whatever and handle files in
> my own way. In that case where should my special file handling cases go?

It's difficult to say how to proceed. On one hand, I don't see an
overwhelming need to support systems without stat, and am tempted
to say that you are on your own.

On the other hand, it appears that people keep asking for it, from
time to time. So if it was possible to support such systems without
making the code too convoluted, it may be worth supporting it.

One thing seems clear: without stat(), we cannot possibly support
.pyc files, at least not in __pycache__. So one consequence of
a lacking stat should be that all the code dealing with caching of
byte code files needs to be disabled. Supporting .pyc as modules
might still be possible.

It's questionable how to deal with path searching in the absence
of stat. Testing for the presence of a file is possible in principle
by trying to open the file, and closing it when it was found to be
present. So in the places where we only check for the presence of
a file, an alternative implementation could be provided.

In any case, it needs someone to champion such a project, preferably
in an ongoing manner (i.e. several years). So if you are interested,
you should
- volunteer to maintain stat-less systems for some time
- create a port of Python 3 that works stat-less
- come back to python-dev for review to determine whether it's
  worth to support such systems.

Alternatively, you can just make your own fork of Python, which
you may or may not publish.


More information about the Python-Dev mailing list