[Python-Dev] Segmentaion fault with wrongly set PYTHONPATH on Windows

anatoly techtonik techtonik at gmail.com
Mon Oct 22 18:26:15 CEST 2012


On Mon, Oct 22, 2012 at 4:40 PM, Victor Stinner
<victor.stinner at gmail.com> wrote:
>>
>>> set PYTHONHOME=C:\
>>> python
>
> The issue #8766 is about PYTHONPATH environment variable, not
> PYTHONHOME. Test on Linux with Python 3.4:
>
> $ PYTHONHOME=/x ./python
> Fatal Python error: Py_Initialize: Unable to get the locale encoding
> ImportError: No module named 'encodings'
> Abandon (core dumped)
>
> It's not a segfault, but an "abort". It's different: abort() is called
> by the application (Python) when something goes wrong. In this case,
> Python is unable to locate the standard library. It's not a bug: I
> asked Python to look in /x directory, whereas this directory doesn't
> exist.

I don't know what is abort() on Linux, but I believe coredumps is not
something you want to get while setting some environment variable. On
Windows it outputs a standard crash dialog box, which immediately
raises questions about Python stability and potential exploitability
in this direction.

>> BTW, what is the role of PYTHONPATH on Windows?
>> Is it a path for %INSTALLDIR%\Lib\site-packages?
>
> Same role than PYTHONPATH on Linux: specify where third party modules
> are installed.

I meant PYTHONHOME, sorry.


More information about the Python-Dev mailing list