summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorTarek Ziadé <ziade.tarek@gmail.com>2008-12-29 22:36:22 (GMT)
committerTarek Ziadé <ziade.tarek@gmail.com>2008-12-29 22:36:22 (GMT)
commit0edab54cdf3db733c0c352ec0e21f1dbb53b506b (patch)
tree53d2307491b0823fba7e88f9b309dfdb2d2feed9 /Lib
parent3f15ae37af29dad0aae835d903f3942a11569d41 (diff)
downloadcpython-0edab54cdf3db733c0c352ec0e21f1dbb53b506b.zip
cpython-0edab54cdf3db733c0c352ec0e21f1dbb53b506b.tar.gz
cpython-0edab54cdf3db733c0c352ec0e21f1dbb53b506b.tar.bz2
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. ........
Diffstat (limited to 'Lib')
-rw-r--r--Lib/distutils/dist.py2
-rw-r--r--Lib/distutils/tests/test_dist.py24
2 files changed, 25 insertions, 1 deletions
diff --git a/Lib/distutils/dist.py b/Lib/distutils/dist.py
index 9ad94fb..c15ca97 100644
--- a/Lib/distutils/dist.py
+++ b/Lib/distutils/dist.py
@@ -235,7 +235,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 6f5fe9c..bf59c41 100644
--- a/Lib/distutils/tests/test_dist.py
+++ b/Lib/distutils/tests/test_dist.py
@@ -8,6 +8,7 @@ import os
import StringIO
import sys
import unittest
+import warnings
from test.test_support import TESTFN
@@ -131,6 +132,29 @@ class DistributionTestCase(unittest.TestCase):
if os.path.exists(my_file):
os.remove(my_file)
+ 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):