]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Merged revisions 68036 via svnmerge from
authorTarek Ziadé <ziade.tarek@gmail.com>
Mon, 29 Dec 2008 22:49:14 +0000 (22:49 +0000)
committerTarek Ziadé <ziade.tarek@gmail.com>
Mon, 29 Dec 2008 22:49:14 +0000 (22:49 +0000)
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.
  ........
................

Lib/distutils/dist.py
Lib/distutils/tests/test_dist.py
Misc/NEWS

index 8bcb88c31badfd11f8b1b68c2c0d00e780a81331..7903c2a783333b78b07b03b9199c8e08cb9d9a64 100644 (file)
@@ -228,7 +228,7 @@ Common commands: (see '--help-commands' for more)
             # 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)
index f1b11c17454a950b199afc729699ccfae2e43806..8e7ef5d33c106da56569351fc0362caa1d091ac0 100644 (file)
@@ -6,6 +6,7 @@ import os
 import io
 import sys
 import unittest
+import warnings
 
 from test.support import TESTFN
 
@@ -96,6 +97,29 @@ class DistributionTestCase(unittest.TestCase):
             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):
index 0c5faa48edc6fc0acc3ec2db4164efd3097d56f8..a70eb61535e19abfb49df49793c566d1865d39c2 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -42,6 +42,9 @@ Core and Builtins
 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.