[python] - backport a patch to fix a change in behaviour in configparse.
Toshio くらとみ
toshio at fedoraproject.org
Thu Sep 16 17:42:16 UTC 2010
commit 7211207a678128bf904a9588aabd4c5c7999d18a
Author: Toshio Kuratomi <toshio at fedoraproject.org>
Date: Thu Sep 16 13:42:05 2010 -0400
- backport a patch to fix a change in behaviour in configparse.
python-2.7-r84443-cfgparse.patch | 66 ++++++++++++++++++++++++++++++++++++++
python.spec | 12 ++++++-
2 files changed, 77 insertions(+), 1 deletions(-)
---
diff --git a/python-2.7-r84443-cfgparse.patch b/python-2.7-r84443-cfgparse.patch
new file mode 100644
index 0000000..eed6e5f
--- /dev/null
+++ b/python-2.7-r84443-cfgparse.patch
@@ -0,0 +1,66 @@
+Index: Lib/ConfigParser.py
+===================================================================
+--- Lib/ConfigParser.py.orig
++++ Lib/ConfigParser.py
+@@ -399,11 +399,10 @@ class RawConfigParser:
+ fp.write("[%s]\n" % section)
+ for (key, value) in self._sections[section].items():
+ if key != "__name__":
+- if value is None:
+- fp.write("%s\n" % (key))
+- else:
+- fp.write("%s = %s\n" %
+- (key, str(value).replace('\n', '\n\t')))
++ if (value is not None) or (self._optcre == self.OPTCRE):
++ key = " = ".join((key, str(value).replace('\n', '\n\t')))
++ fp.write("%s\n" % (key))
++
+ fp.write("\n")
+
+ def remove_option(self, section, option):
+Index: Lib/test/test_cfgparser.py
+===================================================================
+--- Lib/test/test_cfgparser.py.orig
++++ Lib/test/test_cfgparser.py
+@@ -493,6 +493,33 @@ class SafeConfigParserTestCaseNoValue(Sa
+ allow_no_value = True
+
+
++class Issue7005TestCase(unittest.TestCase):
++ """Test output when None is set() as a value and allow_no_value == False.
++
++ http://bugs.python.org/issue7005
++
++ """
++
++ expected_output = "[section]\noption = None\n\n"
++
++ def prepare(self, config_class):
++ # This is the default, but that's the point.
++ cp = config_class(allow_no_value=False)
++ cp.add_section("section")
++ cp.set("section", "option", None)
++ sio = StringIO.StringIO()
++ cp.write(sio)
++ return sio.getvalue()
++
++ def test_none_as_value_stringified(self):
++ output = self.prepare(ConfigParser.ConfigParser)
++ self.assertEqual(output, self.expected_output)
++
++ def test_none_as_value_stringified_raw(self):
++ output = self.prepare(ConfigParser.RawConfigParser)
++ self.assertEqual(output, self.expected_output)
++
++
+ class SortedTestCase(RawConfigParserTestCase):
+ def newconfig(self, defaults=None):
+ self.cf = self.config_class(defaults=defaults, dict_type=SortedDict)
+@@ -524,6 +551,7 @@ def test_main():
+ RawConfigParserTestCase,
+ SafeConfigParserTestCase,
+ SortedTestCase,
++ Issue7005TestCase,
+ SafeConfigParserTestCaseNoValue,
+ )
+
diff --git a/python.spec b/python.spec
index 40f4c79..e10de18 100644
--- a/python.spec
+++ b/python.spec
@@ -94,7 +94,7 @@ Summary: An interpreted, interactive, object-oriented programming language
Name: %{python}
# Remember to also rebase python-docs when changing this:
Version: 2.7
-Release: 9%{?dist}
+Release: 10%{?dist}
License: Python
Group: Development/Languages
Requires: %{python}-libs%{?_isa} = %{version}-%{release}
@@ -268,6 +268,11 @@ Patch54: python-2.6.4-setup-db48.patch
# for 2.7rc1 by dmalcolm:
Patch55: python-2.7rc1-dtrace.patch
+# Backported fix from upstream for regression in ConfigParse's handling
+# of None values
+# http://bugs.python.org/issue7005#msg115417
+Patch56: python-2.7-r84443-cfgparse.patch
+
# "lib64 patches"
# This patch seems to be associated with bug 122304, which was
# http://sourceforge.net/tracker/?func=detail&atid=105470&aid=931848&group_id=5470
@@ -659,6 +664,8 @@ rm -r Modules/zlib || exit 1
%patch55 -p1 -b .systemtap
%endif
+%patch56 -p0 -b .cfgparse
+
%patch110 -p1 -b .selinux
%patch111 -p1 -b .no-static-lib
@@ -1625,6 +1632,9 @@ rm -fr %{buildroot}
# payload file would be unpackaged)
%changelog
+* Thu Sep 16 2010 Toshio Kuratomi <toshio at fedoraproject.org> - 2.7-10
+- backport a patch to fix a change in behaviour in configparse.
+
* Thu Sep 9 2010 David Malcolm <dmalcolm at redhat.com> - 2.7-9
- move most of the payload of the core package to the libs subpackage, given
that the libs aren't meaningfully usable without the standard libraries
More information about the scm-commits
mailing list