[Python-Dev] What's the story on Py_FrozenMain?

Eric Snow ericsnowcurrently at gmail.com
Sat Nov 16 19:07:04 CET 2013


On Sat, Nov 16, 2013 at 10:55 AM, M.-A. Lemburg <mal at egenix.com> wrote:
> It's used as main()-function for frozen Python interpreters.
>
> See eGenix PyRun as an example and the freeze tool in Tools/freeze/
> for the implementation that uses this API:
>
> http://www.egenix.com/products/python/PyRun/

On Sat, Nov 16, 2013 at 10:57 AM, Guido van Rossum <guido at python.org> wrote:
> This is very old DNA. The persistent user request was a way to bundle up a
> Python program as a single executable file that could be sent to a friend or
> colleague and run without first having to install Python. If you Google for
> python freeze you'll still see old references to it.
>
> IIRC I did the original version -- it would scan your main program and try
> to follow all your imports to get a list of modules (yours and stdlib) that
> would be needed, and it would then byte-compile all of these and produce a
> huge C file. You would then compile and link that C file with the rest of
> the Python executable. All extensions would have to be statically linked.
>
> I think this was also used as the basis of a similar tool that worked for
> Windows.
>
> Nowadays installers are much more accessible and easier to use, and Python
> isn't so new and unknown any more, so there's not much demand left.

Thanks for the explanations.  It's interesting stuff. :)

-eric


More information about the Python-Dev mailing list