Michael Hudson <mwh@python.net> writes: > Does this: > > int is_future_div(void) > { > PyCompilerFlags cf; > PyEval_MergeCompilerFlags(&cf); > return cf.cf_flags & CO_FUTURE_DIVISION; > } > > 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>
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4