[Python-checkins] r68037 - in python/branches/release30-maint: Lib/distutils/dist.py Lib/distutils/tests/test_dist.py Misc/NEWS

tarek.ziade python-checkins at python.org
Mon Dec 29 23:49:14 CET 2008


Author: tarek.ziade
Date: Mon Dec 29 23:49:14 2008
New Revision: 68037

Log:
Merged revisions 68036 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/branches/py3k

................
  r68036 | tarek.ziade | 2008-12-29 23:38:38 +0100 (Mon, 29 Dec 2008) | 9 lines
  
  Merged revisions 68033 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r68033 | tarek.ziade | 2008-12-29 23:23:53 +0100 (Mon, 29 Dec 2008) | 1 line
    
    fixed #4646 : distutils was choking on empty options arg in the setup function.
  ........
................


Modified:
   python/branches/release30-maint/   (props changed)
   python/branches/release30-maint/Lib/distutils/dist.py
   python/branches/release30-maint/Lib/distutils/tests/test_dist.py
   python/branches/release30-maint/Misc/NEWS

Modified: python/branches/release30-maint/Lib/distutils/dist.py
==============================================================================
--- python/branches/release30-maint/Lib/distutils/dist.py	(original)
+++ python/branches/release30-maint/Lib/distutils/dist.py	Mon Dec 29 23:49:14 2008
@@ -228,7 +228,7 @@
             # command options will override any supplied redundantly
             # through the general options dictionary.
             options = attrs.get('options')
-            if options:
+            if options is not None:
                 del attrs['options']
                 for (command, cmd_options) in options.items():
                     opt_dict = self.get_option_dict(command)

Modified: python/branches/release30-maint/Lib/distutils/tests/test_dist.py
==============================================================================
--- python/branches/release30-maint/Lib/distutils/tests/test_dist.py	(original)
+++ python/branches/release30-maint/Lib/distutils/tests/test_dist.py	Mon Dec 29 23:49:14 2008
@@ -6,6 +6,7 @@
 import io
 import sys
 import unittest
+import warnings
 
 from test.support import TESTFN
 
@@ -96,6 +97,29 @@
             os.unlink(TESTFN)
 
 
+    def test_empty_options(self):
+        # an empty options dictionary should not stay in the
+        # list of attributes
+        klass = distutils.dist.Distribution
+
+        # catching warnings
+        warns = []
+        def _warn(msg):
+            warns.append(msg)
+
+        old_warn = warnings.warn
+        warnings.warn = _warn
+        try:
+            dist = klass(attrs={'author': 'xxx',
+                                'name': 'xxx',
+                                'version': 'xxx',
+                                'url': 'xxxx',
+                                'options': {}})
+        finally:
+            warnings.warn = old_warn
+
+        self.assertEquals(len(warns), 0)
+
 class MetadataTestCase(unittest.TestCase):
 
     def test_simple_metadata(self):

Modified: python/branches/release30-maint/Misc/NEWS
==============================================================================
--- python/branches/release30-maint/Misc/NEWS	(original)
+++ python/branches/release30-maint/Misc/NEWS	Mon Dec 29 23:49:14 2008
@@ -42,6 +42,9 @@
 Library
 -------
 
+- Issue #4646: distutils was choking on empty options arg in the setup 
+  function. Original patch by Thomas Heller.
+
 - Issue #3767: Convert Tk object to string in tkColorChooser.
 
 - Issue #3248: Allow placing ScrolledText in a PanedWindow.


More information about the Python-checkins mailing list