This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author paul.moore
Recipients brett.cannon, eryksun, paul.moore, serhiy.storchaka, steve.dower, tim.golden, zach.ware
Date 2016-09-27.16:52:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1474995122.98.0.578115089089.issue28247@psf.upfronthosting.co.za>
In-reply-to
Content
I'm still unsure whether this would be a good idea. On the plus side, it provides (in conjunction with the "embedded" distribution) a really good way of producing a standalone application on Windows. On the minus side there are some limitations which may trip up naive users:

* You can't put C extensions in a zipapp
* You have to take care with things like multiprocessing if you're using an embedded app.

And the wrapper's basically only 4 lines of code:

    wchar_t **myargv = _alloca((__argc + 2) * sizeof(wchar_t*));
    myargv[0] = __wargv[0];
    memcpy(myargv + 1, __wargv, (__argc + 1) * sizeof(wchar_t *));
    return Py_Main(__argc+1, myargv);

so it's not exactly rocket science. (By the way, the arguments to Py_Main are "exactly as those which are passed to a C program’s main" - IIRC, for a C program there's always a NULL pointer at the end of argv, does that rule apply to Py_Main, too? The code doesn't seem to rely on it, so I guess I could save a slot in the array above).

Maybe adding a section to the zipapp docs explaining how to make standalone applications would be a better way of handling this? That would have the advantage of being just as applicable to 3.6 (and 3.5, for that matter) at the cost of making users build their own wrapper (or find a published one).
History
Date User Action Args
2016-09-27 16:52:03paul.mooresetrecipients: + paul.moore, brett.cannon, tim.golden, zach.ware, serhiy.storchaka, eryksun, steve.dower
2016-09-27 16:52:02paul.mooresetmessageid: <1474995122.98.0.578115089089.issue28247@psf.upfronthosting.co.za>
2016-09-27 16:52:02paul.moorelinkissue28247 messages
2016-09-27 16:52:02paul.moorecreate