On 28 May 2015 at 19:22, Chris Angelico <rosuav@gmail.com> wrote:
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.
OK, cool. I'm sort of working on that as a bit of a side project - a tiny stub exe that you can prepend to a Python zipapp which runs it via the standard embedding APIs. It's little more than an idea at the moment, but I don't think it'll be too hard to implement... Paul