classification
Title: For non-debug builds, the cygwinccompiler.py should define NDEBUG
Type: behavior Stage: resolved
Components: Distutils, Windows Versions: Python 3.4, Python 3.5, Python 2.7
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: tarek Nosy List: eric.araujo, rpetrov, steve.dower, stutzbach, tarek
Priority: normal Keywords:

Created on 2009-10-21 17:48 by stutzbach, last changed 2021-02-03 18:16 by steve.dower. This issue is now closed.

Messages (9)
msg94315 - (view) Author: Daniel Stutzbach (stutzbach) (Python committer) Date: 2009-10-21 17:48
Currently, msvccompiler.py defines NDEBUG for non-debug builds.  Unix
builds do as well, via python-config.  However, cygwinccompiler.py does not.
msg94326 - (view) Author: Roumen Petrov (rpetrov) * Date: 2009-10-21 21:51
Posix build system read flags from makefile.
Configure script add -DNDEBUG to OPT flag. So why cygwinccompiler.py has
to set this ?
Next cygwinccompiler currently is not used in python build system.
msg94327 - (view) Author: Daniel Stutzbach (stutzbach) (Python committer) Date: 2009-10-21 21:58
Sorry, I should have said the mingw32 compiler, which is contained in
cygwincompiler.py  The mingw32 compiler is a free compiler compatible
with MSVC.  Since it's used with the Windows version of python, there is
no configure script.

I noticed this when trying to build an extension module with "python
setup.py build -c mingw32", using the Windows (not cygwin) version of
python.  The extension module failed to compile because had a line like
this:
  assert(my_struct->debug_only_field);

where "debug_only_field" is only declared if Py_DEBUG is set.  When
NDEBUG is set, the assert disappears and the compile works as expected.
msg94372 - (view) Author: Roumen Petrov (rpetrov) * Date: 2009-10-22 22:14
Ok Daniel.
In this case for debug build _DEBUG has to be defined too - please check
pyconfig.h from MSVC builds.
May be you could use CFLAGS environment variable.
msg112718 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2010-08-03 22:47
Roumen, were you suggesting that this is a user rather than build issue, or just suggesting a workaround until fixed?
msg113302 - (view) Author: Roumen Petrov (rpetrov) * Date: 2010-08-08 19:43
Hi Terry, 
both : 
a) suggestion is for CFLAGS as work-around
b) clarification as build use two preprocessor defines  :
- NDEBUG is defined for non-debug builds
- _DEBUG is defined for debug builds
(ref msvc{9}compiler.py)
msg114538 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-08-21 18:24
Would this change fix an important bug, or is it a feature request? Behavior changes that don’t fix bugs don’t go into distutils.
msg222616 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2014-07-09 13:25
I think this is a bug but on the other hand I found msg94327 extremely confusing.  Would someone like to clarify the situation.
msg386297 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2021-02-03 18:16
Distutils is now deprecated (see PEP 632) and all tagged issues are being closed. From now until removal, only release blocking issues will be considered for distutils.

If this issue does not relate to distutils, please remove the component and reopen it. If you believe it still requires a fix, most likely the issue should be re-reported at https://github.com/pypa/setuptools
History
Date User Action Args
2021-02-03 18:16:17steve.dowersetstatus: open -> closed

nosy: + steve.dower
messages: + msg386297

resolution: out of date
stage: resolved
2019-04-26 18:34:47BreamoreBoysetnosy: - BreamoreBoy
2014-07-09 13:25:14BreamoreBoysetversions: + Python 3.4, Python 3.5, - Python 3.1, Python 3.2
nosy: + BreamoreBoy

messages: + msg222616

type: behavior
2010-08-21 20:49:53terry.reedysetnosy: - terry.reedy
2010-08-21 18:24:33eric.araujosetnosy: + eric.araujo
messages: + msg114538
2010-08-10 11:28:05floxsetnosy: terry.reedy, tarek, stutzbach, rpetrov
components: + Windows
2010-08-08 19:43:17rpetrovsetmessages: + msg113302
2010-08-03 22:47:38terry.reedysetnosy: + terry.reedy

messages: + msg112718
versions: - Python 2.6, Python 2.5, Python 3.0
2009-10-22 22:14:04rpetrovsetmessages: + msg94372
2009-10-21 21:58:13stutzbachsetmessages: + msg94327
2009-10-21 21:51:17rpetrovsetnosy: + rpetrov
messages: + msg94326
2009-10-21 17:49:00stutzbachcreate