python 2.7.12 on Linux behaving differently than on Windows

eryk sun eryksun at gmail.com
Mon Dec 5 13:54:30 EST 2016


On Mon, Dec 5, 2016 at 4:03 PM, Paul  Moore <p.f.moore at gmail.com> wrote:
> 2. On Windows, the OS primitive takes a command line. The application is
> responsible for splitting it into arguments, if it wants to. Most do, for
> compatibility with the normal argv convention inherited via C from Unix. Many
> programs let the C runtime do that splitting for them - I don't recall if Python
> does, or if it implements its own splitting these days.

Windows Python uses the CRTs parsed argument list. python.exe simply
uses the wmain entry point:

    int
    wmain(int argc, wchar_t **argv)
    {
        return Py_Main(argc, argv);
    }

pythonw.exe uses the wWinMain entry point and the CRT's __argc and
__wargv variables:

    int WINAPI wWinMain(
        HINSTANCE hInstance,      /* handle to current instance */
        HINSTANCE hPrevInstance,  /* handle to previous instance */
        LPWSTR lpCmdLine,         /* pointer to command line */
        int nCmdShow              /* show state of window */
    )
    {
        return Py_Main(__argc, __wargv);
    }

python[w].exe doesn't link in wsetargv.obj, so it doesn't support
wildcard expansion.



More information about the Python-list mailing list