Title: DISTUTILS_DEBUG causes stack trace, really simple fix
Type: Stage:
Components: Distutils Versions: Python 3.1, Python 3.2, Python 2.7
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: tarek Nosy List: nedbat, tarek
Priority: normal Keywords:

Created on 2009-09-20 20:27 by nedbat, last changed 2009-09-21 14:01 by tarek. This issue is now closed.

Messages (5)
msg92916 - (view) Author: Ned Batchelder (nedbat) * (Python triager) Date: 2009-09-20 20:27
If you set the environment variable DISTUTILS_DEBUG=1, distutils will
run with DEBUG, which will trace internal activity.  But one of the
traces is incorrect, and leads to this stack trace: 

Traceback (most recent call last):
  File "", line 116, in <module>
  File "c:\python31\lib\distutils\", line 123, in setup
  File "c:\python31\lib\distutils\", line 357, in parse_config_files
    self.announce("  reading", filename)
  File "c:\python31\lib\distutils\", line 911, in announce
    log.log(level, msg)
  File "c:\python31\lib\distutils\", line 31, in log
    self._log(level, msg, args)
  File "c:\python31\lib\distutils\", line 20, in _log
    if level >= self.threshold:
TypeError: unorderable types: str() >= int()

The fix is simple: at line 356 of, change:

            if DEBUG:
                self.announce("  reading", filename)

            if DEBUG:
                self.announce("  reading " + filename)
msg92918 - (view) Author: Ned Batchelder (nedbat) * (Python triager) Date: 2009-09-20 21:08
Another one:

Traceback (most recent call last):
  File "", line 72, in <module>
  File "c:\python31\lib\distutils\", line 149, in setup
  File "c:\python31\lib\distutils\", line 919, in run_commands
  File "c:\python31\lib\distutils\", line 937, in run_command
  File "c:\python31\lib\distutils\", line 109, in ensure_finalized
  File "c:\python31\lib\distutils\command\", line 315, in
  File "c:\python31\lib\distutils\command\", line 427, in
    opt_name = opt_name.translate(longopt_xlate)
TypeError: 'function' object is not subscriptable
msg92919 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2009-09-20 22:41
Thanks for noticing this. I'll add some test covering these and fix the
msg92937 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2009-09-21 13:11
Mmm, the problem is deeper for the second stack trace: 

distutils.fancy_getopt.longopt_xlate was changed from a translation
mapping into a lambda in py3, that's why you have it.

I'm fixing back this problem too.
msg92941 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2009-09-21 14:01
Everything is covered now, and the mentioned bug is fixed in 
trunk (r74994), py3k (r74999) and release31 (75000).

Thanks !
Date User Action Args
2009-09-21 14:01:09tareksetstatus: open -> closed

messages: + msg92941
2009-09-21 13:37:58tareksetversions: + Python 2.7
2009-09-21 13:11:11tareksetmessages: + msg92937
versions: + Python 3.2
2009-09-20 22:41:34tareksetpriority: normal
resolution: accepted
messages: + msg92919
2009-09-20 21:08:43nedbatsetmessages: + msg92918
2009-09-20 20:27:42nedbatcreate