[Python-Dev] Re: Future division detection (original) (raw)
Christopher A. Craig com-nospam@ccraig.org
05 Nov 2001 12:56:36 -0500
- Previous message: [Python-Dev] Re: Future division detection
- Next message: [Python-Dev] Re: Future division detection
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Michael Hudson <mwh@python.net> writes:
Does this:
int isfuturediv(void) { PyCompilerFlags cf; PyEvalMergeCompilerFlags(&cf); return cf.cfflags & COFUTUREDIVISION; } work?
Yes! That's exactly the sort of thing I was looking for. I couldn't find the "PyEval_MergeCompilerFlags()" call.
You'll need to change this when future division becomes the default, but I think it'll work today. This is a murky dark corner of the interpreter, though -- so don't blame me when it breaks!
I knew this, but my alternative was having to change behavior when future division becomes default, which would be much worse.
When I decided to try to make my module into a patch and bend integers and longs to my will I knew that I was going to have to enter murky corners of the interpreter :-)
-- Christopher A. Craig <com-nospam@ccraig.org>
- Previous message: [Python-Dev] Re: Future division detection
- Next message: [Python-Dev] Re: Future division detection
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]