Hello community,

here is the log from the commit of package python3 for openSUSE:Factory checked 
in at 2018-02-14 09:18:21
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python3 (Old)
 and      /work/SRC/openSUSE:Factory/.python3.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python3"

Wed Feb 14 09:18:21 2018 rev:84 rq:573616 version:3.6.4

Changes:
--------
--- /work/SRC/openSUSE:Factory/python3/python3-base.changes     2018-01-26 
13:58:52.099028135 +0100
+++ /work/SRC/openSUSE:Factory/.python3.new/python3-base.changes        
2018-02-14 09:18:29.212042108 +0100
@@ -1,0 +2,6 @@
+Wed Feb  7 09:10:03 UTC 2018 - tchva...@suse.com
+
+- Add patch to fix glibc 2.27 fail bsc#1079761:
+  * fix-localeconv-encoding-for-LC_NUMERIC.patch
+
+-------------------------------------------------------------------
python3-doc.changes: same change
--- /work/SRC/openSUSE:Factory/python3/python3.changes  2018-01-26 
13:58:53.094981636 +0100
+++ /work/SRC/openSUSE:Factory/.python3.new/python3.changes     2018-02-14 
09:18:31.407962511 +0100
@@ -1,0 +2,12 @@
+Wed Feb  7 09:10:03 UTC 2018 - tchva...@suse.com
+
+- Add patch to fix glibc 2.27 fail bsc#1079761:
+  * fix-localeconv-encoding-for-LC_NUMERIC.patch
+
+-------------------------------------------------------------------
+Mon Feb  5 17:14:43 UTC 2018 - norm...@linux.vnet.ibm.com
+
+- Update skip_random_failing_tests.patch (for PowerPC)
+  to avoid test_call_later failure
+
+-------------------------------------------------------------------

New:
----
  fix-localeconv-encoding-for-LC_NUMERIC.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python3-base.spec ++++++
--- /var/tmp/diff_new_pack.4WE9dQ/_old  2018-02-14 09:18:32.743914087 +0100
+++ /var/tmp/diff_new_pack.4WE9dQ/_new  2018-02-14 09:18:32.747913941 +0100
@@ -169,6 +169,8 @@
 Patch22:        distutils-reproducible-compile.patch
 # skip some tests only for PowerPC
 Patch23:        skip_random_failing_tests.patch
+# Fix glibc-2.27 fail
+Patch24:        fix-localeconv-encoding-for-LC_NUMERIC.patch
 ### COMMON-PATCH-END ###
 
 %description
@@ -264,6 +266,7 @@
 %ifarch ppc ppc64 ppc64le
 %patch23 -p1
 %endif
+%patch24 -p1
 
 # drop Autoconf version requirement
 sed -i 's/^AC_PREREQ/dnl AC_PREREQ/' configure.ac

python3-doc.spec: same change
python3.spec: same change

++++++ fix-localeconv-encoding-for-LC_NUMERIC.patch ++++++
diff --git a/Doc/library/locale.rst b/Doc/library/locale.rst
index b04442bc162..9a0c570533a 100644
--- a/Doc/library/locale.rst
+++ b/Doc/library/locale.rst
@@ -147,6 +147,16 @@ The :mod:`locale` module defines the following exception 
and functions:
    | ``CHAR_MAX`` | Nothing is specified in this locale.    |
    +--------------+-----------------------------------------+
 
+   The function sets temporarily the ``LC_CTYPE`` locale to the ``LC_NUMERIC``
+   locale to decode ``decimal_point`` and ``thousands_sep`` byte strings if
+   they are non-ASCII or longer than 1 byte, and the ``LC_NUMERIC`` locale is
+   different than the ``LC_CTYPE`` locale. This temporary change affects other
+   threads.
+
+   .. versionchanged:: 3.6.5
+      The function now sets temporarily the ``LC_CTYPE`` locale to the
+      ``LC_NUMERIC`` locale in some cases.
+
 
 .. function:: nl_langinfo(option)
 
diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst
index 196a4c00056..d8a1647e8b5 100644
--- a/Doc/library/stdtypes.rst
+++ b/Doc/library/stdtypes.rst
@@ -1599,6 +1599,20 @@ expression support in the :mod:`re` module).
    See :ref:`formatstrings` for a description of the various formatting options
    that can be specified in format strings.
 
+   .. note::
+      When formatting a number (:class:`int`, :class:`float`, :class:`float`
+      and subclasses) with the ``n`` type (ex: ``'{:n}'.format(1234)``), the
+      function sets temporarily the ``LC_CTYPE`` locale to the ``LC_NUMERIC``
+      locale to decode ``decimal_point`` and ``thousands_sep`` fields of
+      :c:func:`localeconv` if they are non-ASCII or longer than 1 byte, and the
+      ``LC_NUMERIC`` locale is different than the ``LC_CTYPE`` locale. This
+      temporary change affects other threads.
+
+   .. versionchanged:: 3.6.5
+      When formatting a number with the ``n`` type, the function sets
+      temporarily the ``LC_CTYPE`` locale to the ``LC_NUMERIC`` locale in some
+      cases.
+
 
 .. method:: str.format_map(mapping)
 
diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst
index 847b50140a6..f83508c9250 100644
--- a/Doc/whatsnew/3.6.rst
+++ b/Doc/whatsnew/3.6.rst
@@ -2346,3 +2346,11 @@ It has been replaced by the new ``make regen-all`` 
target.
 (Contributed by Victor Stinner in :issue:`23404`.)
 
 .. versionchanged:: 3.6.2
+
+
+Notable changes in Python 3.6.5
+===============================
+
+The :func:`locale.localeconv` function now sets temporarily the ``LC_CTYPE``
+locale to the ``LC_NUMERIC`` locale in some cases.
+(Contributed by Victor Stinner in :issue:`31900`.)
diff --git a/Include/fileutils.h b/Include/fileutils.h
index 900c70faad7..875715df97a 100644
--- a/Include/fileutils.h
+++ b/Include/fileutils.h
@@ -119,6 +119,11 @@ PyAPI_FUNC(int) _Py_get_blocking(int fd);
 PyAPI_FUNC(int) _Py_set_blocking(int fd, int blocking);
 #endif   /* !MS_WINDOWS */
 
+PyAPI_FUNC(int) _Py_GetLocaleconvNumeric(
+    PyObject **decimal_point,
+    PyObject **thousands_sep,
+    const char **grouping);
+
 #endif   /* Py_LIMITED_API */
 
 #ifdef __cplusplus
diff --git a/Modules/_localemodule.c b/Modules/_localemodule.c
index 71c9146ccb8..95b370b1ad0 100644
--- a/Modules/_localemodule.c
+++ b/Modules/_localemodule.c
@@ -171,12 +171,6 @@ PyLocale_localeconv(PyObject* self)
         RESULT(#i, x); \
     } while (0)
 
-    /* Numeric information */
-    RESULT_STRING(decimal_point);
-    RESULT_STRING(thousands_sep);
-    x = copy_grouping(l->grouping);
-    RESULT("grouping", x);
-
     /* Monetary information */
     RESULT_STRING(int_curr_symbol);
     RESULT_STRING(currency_symbol);
@@ -195,6 +189,32 @@ PyLocale_localeconv(PyObject* self)
     RESULT_INT(n_sep_by_space);
     RESULT_INT(p_sign_posn);
     RESULT_INT(n_sign_posn);
+
+    /* Numeric information */
+    PyObject *decimal_point, *thousands_sep;
+    const char *grouping;
+    if (_Py_GetLocaleconvNumeric(&decimal_point,
+                                 &thousands_sep,
+                                 &grouping) < 0) {
+        goto failed;
+    }
+
+    if (PyDict_SetItemString(result, "decimal_point", decimal_point) < 0) {
+        Py_DECREF(decimal_point);
+        Py_DECREF(thousands_sep);
+        goto failed;
+    }
+    Py_DECREF(decimal_point);
+
+    if (PyDict_SetItemString(result, "thousands_sep", thousands_sep) < 0) {
+        Py_DECREF(thousands_sep);
+        goto failed;
+    }
+    Py_DECREF(thousands_sep);
+
+    x = copy_grouping(grouping);
+    RESULT("grouping", x);
+
     return result;
 
   failed:
diff --git a/Python/fileutils.c b/Python/fileutils.c
index 97505e5bc6d..14dd81b03f0 100644
--- a/Python/fileutils.c
+++ b/Python/fileutils.c
@@ -1597,3 +1597,80 @@ _Py_set_blocking(int fd, int blocking)
     return -1;
 }
 #endif
+
+
+int
+_Py_GetLocaleconvNumeric(PyObject **decimal_point, PyObject **thousands_sep,
+                         const char **grouping)
+{
+    int res = -1;
+
+    struct lconv *lc = localeconv();
+
+    int change_locale = 0;
+    if (decimal_point != NULL &&
+        (strlen(lc->decimal_point) > 1 || ((unsigned 
char)lc->decimal_point[0]) > 127))
+    {
+        change_locale = 1;
+    }
+    if (thousands_sep != NULL &&
+        (strlen(lc->thousands_sep) > 1 || ((unsigned 
char)lc->thousands_sep[0]) > 127))
+    {
+        change_locale = 1;
+    }
+
+    /* Keep a copy of the LC_CTYPE locale */
+    char *oldloc = NULL, *loc = NULL;
+    if (change_locale) {
+        oldloc = setlocale(LC_CTYPE, NULL);
+        if (!oldloc) {
+            PyErr_SetString(PyExc_RuntimeWarning, "faild to get LC_CTYPE 
locale");
+            return -1;
+        }
+
+        oldloc = _PyMem_Strdup(oldloc);
+        if (!oldloc) {
+            PyErr_NoMemory();
+            return -1;
+        }
+
+        loc = setlocale(LC_NUMERIC, NULL);
+        if (loc != NULL && strcmp(loc, oldloc) == 0) {
+            loc = NULL;
+        }
+
+        if (loc != NULL) {
+            /* Only set the locale temporarilty the LC_CTYPE locale
+               if LC_NUMERIC locale is different than LC_CTYPE locale and
+               decimal_point and/or thousands_sep are non-ASCII or longer than
+               1 byte */
+            setlocale(LC_CTYPE, loc);
+        }
+    }
+
+    if (decimal_point != NULL) {
+        *decimal_point = PyUnicode_DecodeLocale(lc->decimal_point, NULL);
+        if (*decimal_point == NULL) {
+            goto error;
+        }
+    }
+    if (thousands_sep != NULL) {
+        *thousands_sep = PyUnicode_DecodeLocale(lc->thousands_sep, NULL);
+        if (*thousands_sep == NULL) {
+            goto error;
+        }
+    }
+
+    if (grouping != NULL) {
+        *grouping = lc->grouping;
+    }
+
+    res = 0;
+
+error:
+    if (loc != NULL) {
+        setlocale(LC_CTYPE, oldloc);
+    }
+    PyMem_Free(oldloc);
+    return res;
+}
diff --git a/Python/formatter_unicode.c b/Python/formatter_unicode.c
index d2be76f1e1a..d3ef650e6ce 100644
--- a/Python/formatter_unicode.c
+++ b/Python/formatter_unicode.c
@@ -707,18 +707,11 @@ get_locale_info(enum LocaleType type, LocaleInfo 
*locale_info)
 {
     switch (type) {
     case LT_CURRENT_LOCALE: {
-        struct lconv *locale_data = localeconv();
-        locale_info->decimal_point = PyUnicode_DecodeLocale(
-                                         locale_data->decimal_point,
-                                         NULL);
-        if (locale_info->decimal_point == NULL)
+        if (_Py_GetLocaleconvNumeric(&locale_info->decimal_point,
+                                     &locale_info->thousands_sep,
+                                     &locale_info->grouping) < 0) {
             return -1;
-        locale_info->thousands_sep = PyUnicode_DecodeLocale(
-                                         locale_data->thousands_sep,
-                                         NULL);
-        if (locale_info->thousands_sep == NULL)
-            return -1;
-        locale_info->grouping = locale_data->grouping;
+        }
         break;
     }
     case LT_DEFAULT_LOCALE:

++++++ skip_random_failing_tests.patch ++++++
--- /var/tmp/diff_new_pack.4WE9dQ/_old  2018-02-14 09:18:33.175898428 +0100
+++ /var/tmp/diff_new_pack.4WE9dQ/_new  2018-02-14 09:18:33.175898428 +0100
@@ -10,6 +10,7 @@
 in test_events.py:
     test_run_until_complete
     test_signal_handling_args
+    test_call_later
 
 Reported to fail on ppc64le host on multiple osc build trials:
 (all failed for ppc64le, except one for ppc)
@@ -54,12 +55,30 @@
     self.assertLess(delta, expected + 2)
 AssertionError: 5.576360702514648 not less than 5
 ===
+===
+======================================================================
+FAIL: test_call_later (test.test_asyncio.test_events.PollEventLoopTests)
+----------------------------------------------------------------------
+Traceback (most recent call last):
+  File 
"/home/abuild/rpmbuild/BUILD/Python-3.6.4/Lib/test/test_asyncio/test_events.py",
 line 309, in test_call_later
+    self.assertTrue(0.08 <= t1-t0 <= 0.8, t1-t0)
+AssertionError: False is not true : 2.7154626529999746
+
+======================================================================
+FAIL: test_call_later (test.test_asyncio.test_events.SelectEventLoopTests)
+----------------------------------------------------------------------
+Traceback (most recent call last):
+  File 
"/home/abuild/rpmbuild/BUILD/Python-3.6.4/Lib/test/test_asyncio/test_events.py",
 line 309, in test_call_later
+    self.assertTrue(0.08 <= t1-t0 <= 0.8, t1-t0)
+AssertionError: False is not true : 4.137590406000015
+===
+
 
 Signed-off-by: Michel Normand <norm...@linux.vnet.ibm.com>
 ---
- Lib/test/_test_multiprocessing.py    |    2 ++
- Lib/test/test_asyncio/test_events.py |    2 ++
- 2 files changed, 4 insertions(+)
+ Lib/test/_test_multiprocessing.py    |    3 +++
+ Lib/test/test_asyncio/test_events.py |    4 +++-
+ 2 files changed, 6 insertions(+), 1 deletion(-)
 
 Index: Python-3.6.4/Lib/test/_test_multiprocessing.py
 ===================================================================
@@ -101,6 +120,15 @@
      def test_run_until_complete(self):
          t0 = self.loop.time()
          self.loop.run_until_complete(asyncio.sleep(0.1, loop=self.loop))
+@@ -305,7 +306,7 @@ class EventLoopTestsMixin:
+         self.loop.run_forever()
+         t1 = time.monotonic()
+         self.assertEqual(results, ['hello world'])
+-        self.assertTrue(0.08 <= t1-t0 <= 0.8, t1-t0)
++        self.assertTrue(0.08 <= t1-t0 <= 5.0, t1-t0)
+ 
+     def test_call_soon(self):
+         results = []
 @@ -549,6 +550,7 @@ class EventLoopTestsMixin:
          self.assertEqual(caught, 1)
  


Reply via email to