Missing stat.S_IFDOOR when running from a virtualenv

Create issue
Issue #3073 resolved
Ronan Lamy created an issue

S_IFDOOR is defined in _stat (in lib-pypy) but is supposed to be exposed in (lib-python) stat. Outside a virtualenv, stat imports S_IFDOOR from _stat. With a nightly in a virtualenv, however, from _stat import * seems to fail in stat, though it's still possible to import _stat afterwards.

Comments (4)

  1. Ronan Lamy reporter

    The issue is that stat is imported very early, before virtualenv's site adds the base environment to sys.path, and _stat isn't present in the virtualenv's lib_pypy/. So the options are:

    • Fix virtualenv to add a symlink to lib_pypy/_stat.py
    • Replace lib_pypy/_stat.py with a builtin _stat module (i.e. pypy/module/_stat)
    • Remove _stat.py and add the missing constants to stat.py (cf. https://bugs.python.org/issue38109 )
  2. Armin Rigo

    I would vote for the third option: add these three lines to stat.py and remove any _stat module.

  3. Log in to comment