summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/distutils/dist.py2
-rw-r--r--Lib/distutils/tests/test_dist.py24
-rw-r--r--Misc/NEWS3
3 files changed, 28 insertions, 1 deletions
diff --git a/Lib/distutils/dist.py b/Lib/distutils/dist.py
index 8bcb88c..7903c2a 100644
--- a/Lib/distutils/dist.py
+++ b/Lib/distutils/dist.py
@@ -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)
diff --git a/Lib/distutils/tests/test_dist.py b/Lib/distutils/tests/test_dist.py
index f1b11c1..8e7ef5d 100644
--- a/Lib/distutils/tests/test_dist.py
+++ b/Lib/distutils/tests/test_dist.py
@@ -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):
diff --git a/Misc/NEWS b/Misc/NEWS
index e99ee0b..49656a6 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -64,6 +64,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.