[Python-Dev] Single-file Python executables (was: Computed Goto dispatch for Python 2)

Chris Angelico rosuav at gmail.com
Thu May 28 20:22:43 CEST 2015

On Fri, May 29, 2015 at 3:52 AM, Paul Moore <p.f.moore at gmail.com> wrote:
> On 28 May 2015 at 18:15, Chris Angelico <rosuav at gmail.com> wrote:
>> Unix-like systems have this courtesy of the shebang, so as long as
>> there's some sort of Python installed, people don't need to know or
>> care that /usr/local/bin/mailmail is implemented in Python. Maybe the
>> solution is to push for Windows to always include a Python
>> interpreter, which would allow a tiny stub to go and call on that?
> Unfortunately (and believe me, I've been down this road many times) on
> Windows *only* the exe format is a "first-class" executable.
> Executable scripts and shebangs are very useful, but there are always
> corner cases where they don't work *quite* like an exe. On Windows,
> you have to be prepared to ship an exe if you want to compete with
> languages that generate exes.

I'm aware of that. When I said "a tiny stub", I was thinking in terms
of a small executable. The idea is that its sole purpose is to locate
Python someplace else, and chain to it; that has to be actual
executable code, complete with the 512-byte "MZ" header and
everything, to ensure compatibility. But it should be able to be
small, tight, and easy to verify correctness of, so there aren't (in
theory!) security exploits in the header itself.


More information about the Python-Dev mailing list