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

Guido van Rossum guido at python.org
Sat Nov 16 18:57:20 CET 2013

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

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.


On Sat, Nov 16, 2013 at 9:48 AM, Eric Snow <ericsnowcurrently at gmail.com>wrote:

> While looking at something unrelated, I happened to peek at
> Python/frozenmain.c and found Py_FrozenMain().  I kind of get the idea
> of it, but am curious what motivated the addition and who might be
> using it.  The function is not documented and doesn't have much
> explanation.  I'm guessing that not many are familiar with it (e.g.
> http://bugs.python.org/issue15893).
> FWIW the function was added quite a while ago (and hasn't been touched
> a whole lot since):
> changeset:   1270:14369a5e61679364deeae9a9a0deedbd593a72e0
> branch:      legacy-trunk
> user:        Guido van Rossum <guido at python.org>
> date:        Thu Apr 01 20:59:32 1993 +0000
> summary:     Support for frozen scripts; added -i option.
> -eric
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
> https://mail.python.org/mailman/options/python-dev/guido%40python.org

--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20131116/d6c1d1fb/attachment.html>

More information about the Python-Dev mailing list