In the mean time, I've re-opened the following pull request that can be merged independent of these changes (it's just additional test coverage).
trivial: add test coverage for the __debug__ case (optimization levels) https://github.com/python/cpython/pull/3450
Please let me know if I should create a bpo for it, if the commit message is too long, or if you think I should otherwise change the patch in any way.
As always, thanks for your time folks!
On Fri, Sep 29, 2017 at 2:24 PM, Diana Clarke
Oh, I like this idea!
I had very briefly considered treating the existing flag as a bitfield, but then promptly forgot to explore that line of thought further.
I'll play with that approach next week, see where it takes me, and then report back.
Thanks so much for taking the time to think this through with me – much appreciated.
On Fri, Sep 29, 2017 at 1:33 AM, Nick Coghlan email@example.com wrote:
The "redefine optimizations as a bitfield" approach seems particularly promising to me - it's a full integer, so even with all negative numbers disallowed and the two low order bits reserved for the legacy combinations, that's still 29 different optimisation flags given 32-bit integers. We currently have 3, so that's room for an 866% increase in the number of defined flags :)