title: How may I override the compiler (GCC) flags that setup.py uses by default?
body: <p>I understand that <code>setup.py</code> uses the same <code>CFLAGS</code> that were used to build Python. I have a single C extension of ours that is segfaulting. I need to build it <strong>without</strong> <code>-O2</code> because <code>-O2</code> is optimizing out some values and code so that the core files are not sufficient to pin down the problem.</p>
  <p>I just need to modify <code>setup.py</code> so that <code>-O2</code> is not used.</p>
  <p>I've read <code>distutils</code> documentation, in particular <code>distutils.ccompiler</code> and <code>distutils.unixccompiler</code> and see how to add flags and libs and includes, but not how to modify the default GCC flags.</p>
  <p>Specifically, this is for a legacy product on Python 2.5.1 with a bunch of backports (Fedora 8, yes, I know...). No, I cannot change the OS or Python version and I cannot, without great problems, recompile Python. I just need to build a one off of the C extension for one customer whose environment is the only one segfaulting.</p>