[python] fix "import decimal" in the Turkish locale (patch 131; rhbz#694928)
dmalcolm
dmalcolm at fedoraproject.org
Tue Apr 12 15:32:22 UTC 2011
commit 94723519482fe34730362bf0eb99dfd59411d479
Author: David Malcolm <dmalcolm at redhat.com>
Date: Tue Apr 12 11:32:15 2011 -0400
fix "import decimal" in the Turkish locale (patch 131; rhbz#694928)
python-2.7.1-fix-decimal-in-turkish-locale.patch | 50 ++++++++++++++++++++++
python.spec | 11 ++++-
2 files changed, 60 insertions(+), 1 deletions(-)
---
diff --git a/python-2.7.1-fix-decimal-in-turkish-locale.patch b/python-2.7.1-fix-decimal-in-turkish-locale.patch
new file mode 100644
index 0000000..4645542
--- /dev/null
+++ b/python-2.7.1-fix-decimal-in-turkish-locale.patch
@@ -0,0 +1,50 @@
+diff -up Python-2.7.1/Lib/decimal.py.fix-decimal-in-turkish-locale Python-2.7.1/Lib/decimal.py
+--- Python-2.7.1/Lib/decimal.py.fix-decimal-in-turkish-locale 2010-07-08 17:22:54.000000000 -0400
++++ Python-2.7.1/Lib/decimal.py 2011-04-12 11:30:40.850350842 -0400
+@@ -1720,8 +1720,6 @@ class Decimal(object):
+ # here self was representable to begin with; return unchanged
+ return Decimal(self)
+
+- _pick_rounding_function = {}
+-
+ # for each of the rounding functions below:
+ # self is a finite, nonzero Decimal
+ # prec is an integer satisfying 0 <= prec < len(self._int)
+@@ -1788,6 +1786,17 @@ class Decimal(object):
+ else:
+ return -self._round_down(prec)
+
++ _pick_rounding_function = dict(
++ ROUND_DOWN = '_round_down',
++ ROUND_UP = '_round_up',
++ ROUND_HALF_UP = '_round_half_up',
++ ROUND_HALF_DOWN = '_round_half_down',
++ ROUND_HALF_EVEN = '_round_half_even',
++ ROUND_CEILING = '_round_ceiling',
++ ROUND_FLOOR = '_round_floor',
++ ROUND_05UP = '_round_05up',
++ )
++
+ def fma(self, other, third, context=None):
+ """Fused multiply-add.
+
+@@ -3705,18 +3714,6 @@ _numbers.Number.register(Decimal)
+
+ ##### Context class #######################################################
+
+-
+-# get rounding method function:
+-rounding_functions = [name for name in Decimal.__dict__.keys()
+- if name.startswith('_round_')]
+-for name in rounding_functions:
+- # name is like _round_half_even, goes to the global ROUND_HALF_EVEN value.
+- globalname = name[1:].upper()
+- val = globals()[globalname]
+- Decimal._pick_rounding_function[val] = name
+-
+-del name, val, globalname, rounding_functions
+-
+ class _ContextManager(object):
+ """Context manager class to support localcontext().
+
+diff -up Python-2.7.1/Misc/NEWS.fix-decimal-in-turkish-locale Python-2.7.1/Misc/NEWS
diff --git a/python.spec b/python.spec
index efe0d3d..b88602f 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.1
-Release: 6%{?dist}
+Release: 7%{?dist}
License: Python
Group: Development/Languages
Requires: %{python}-libs%{?_isa} = %{version}-%{release}
@@ -425,6 +425,11 @@ Patch128: python-2.7.1-fix_test_abc_with_COUNT_ALLOCS.patch
# See http://bugs.python.org/issue10655 and rhbz#661510
Patch130: python-3.2b2-fix-ppc-debug-build.patch
+# Fix "import decimal" in the Turkish locale (rhbz#694928)
+# Based on upstream commit:
+# http://hg.python.org/cpython/rev/b4b1f557d563/
+Patch131: python-2.7.1-fix-decimal-in-turkish-locale.patch
+
# This is the generated patch to "configure"; see the description of
# %{regenerate_autotooling_patch}
@@ -677,6 +682,7 @@ rm -r Modules/zlib || exit 1
%patch127 -p0 -b .fix-test_structmember-on-64bit-bigendian
%patch128 -p1
%patch130 -p1
+%patch131 -p1
# This shouldn't be necesarry, but is right now (2.2a3)
find -name "*~" |xargs rm -f
@@ -1621,6 +1627,9 @@ rm -fr %{buildroot}
# payload file would be unpackaged)
%changelog
+* Tue Apr 12 2011 David Malcolm <dmalcolm at redhat.com> - 2.7.1-7
+- fix "import decimal" in the Turkish locale (patch 131; rhbz#694928)
+
* Wed Feb 09 2011 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 2.7.1-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
More information about the scm-commits
mailing list