On Apr 21, 2009, at 8:06 PM, Lisandro Dalcin wrote: > On Tue, Apr 21, 2009 at 11:50 PM, Robert Bradshaw > <[email protected]> wrote: >>> >>>> It would be good to have it behave more like python -m >>>> http://trac.cython.org/cython_trac/ticket/291 >>> >>> Mmm... I´m not sure python -m will be equivalent to your embeding... >>> Py_Main() does a lot of things other thanInitialize() && SetArgv >>> (), I >>> do not remember right now, but IIRC some environ vars are >>> inspected in >>> Py_Main() >> >> Hmm... I'd like to see a list of what happens before we decide to opt >> for python -m semantics or simplicity. I'm going to leave the ticket >> open for now. >> > > Perhaps I was not clear enough... I mean, 'python -m' is one thing, a > binary executable embedding Python is a different beast... You are > adding support for generating a bin exe, so IMHO you should keep it > SIMPLE, at least for now...
I agree. I'll change the subject of the ticket title. >>> In short, I would check for SystemExit and honor its return code, or >>> just return "-1" >> >> Interestingly enough, the C-API call PyErr_PrintEx does this for you. >> (Yeah, I might call it a bit hackish, but that's what Python seems to >> use). >> > > Wow... I see... So you call PyErr_PrintEx(0) (likely passing 1 will be > pointless, right?) There might be memory cleanup advantages one way or the other. I'm calling PyErr_Print() which defaults to 1. > and you are done. Well, it only exits if it's a SystemExit, but basically, yes. - Robert _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
