[Python-Dev] [patch] moving file load to AFTER Py_Initialize performed

Luke Kenneth Casson Leighton luke.leighton at googlemail.com
Fri Jan 16 00:08:20 CET 2009


http://bugs.python.org/issue4956

uhn... weird bug, totally left-field scenario (using python under msys
under wine under linux) but this rather strange scenario has a
situation where loading the filename from the command line cannot be
done until _after_ PyInitialize is called.  prior to PyInitialize()
being called, file handling including stderr is _so_ screwed that it's
impossible to even use sprintf(stderr, "help help there's something
wrong!\n") to diagnose the problem.

i wanted to ask people: does this patch (in #4956) look... reasonable?

there's no global variables or subtle interaction that "steals" argv
or argc (as part of PyInitialize()) is there, that would, once it's
finished, disrupt the loading of the file?

if so, it would be necessary to split up the code that "gets" the
filename (filename = argv[_PyOS_optind]) and leave that _bfore_
PyInitialize(), from the code that _loads_ the file (into fp).

following the deployment of this fix, the build of python under
msys+wine+linux proceeds _from_ msys, rather than having to be
irritatingly interrupted and continued from "wineconsole cmd".

l.


More information about the Python-Dev mailing list