Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4450dcf

Browse files
author
Tarek Ziadé
committed
Merged revisions 68033 via svnmerge from
svn+ssh://[email protected]/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. ........
1 parent 0fa3f3d commit 4450dcf

3 files changed

Lines changed: 28 additions & 1 deletion

File tree

Lib/distutils/dist.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ def __init__ (self, attrs=None):
228228
# command options will override any supplied redundantly
229229
# through the general options dictionary.
230230
options = attrs.get('options')
231-
if options:
231+
if options is not None:
232232
del attrs['options']
233233
for (command, cmd_options) in options.items():
234234
opt_dict = self.get_option_dict(command)

Lib/distutils/tests/test_dist.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import io
77
import sys
88
import unittest
9+
import warnings
910

1011
from test.support import TESTFN
1112

@@ -96,6 +97,29 @@ def test_command_packages_configfile(self):
9697
os.unlink(TESTFN)
9798

9899

100+
def test_empty_options(self):
101+
# an empty options dictionary should not stay in the
102+
# list of attributes
103+
klass = distutils.dist.Distribution
104+
105+
# catching warnings
106+
warns = []
107+
def _warn(msg):
108+
warns.append(msg)
109+
110+
old_warn = warnings.warn
111+
warnings.warn = _warn
112+
try:
113+
dist = klass(attrs={'author': 'xxx',
114+
'name': 'xxx',
115+
'version': 'xxx',
116+
'url': 'xxxx',
117+
'options': {}})
118+
finally:
119+
warnings.warn = old_warn
120+
121+
self.assertEquals(len(warns), 0)
122+
99123
class MetadataTestCase(unittest.TestCase):
100124

101125
def test_simple_metadata(self):

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ Core and Builtins
6464
Library
6565
-------
6666

67+
- Issue #4646: distutils was choking on empty options arg in the setup
68+
function. Original patch by Thomas Heller.
69+
6770
- Issue #3767: Convert Tk object to string in tkColorChooser.
6871

6972
- Issue #3248: Allow placing ScrolledText in a PanedWindow.

0 commit comments

Comments
 (0)