[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#750120: marked as done (python-apt: Some locales use no-breaking space for LC_NUMBER, so return unicode for SizeToStr)



Your message dated Sun, 19 Apr 2020 19:43:26 +0200
with message-id <20200419194207.GA3754456@debian.org>
and subject line Re: Bug#750120: python-apt: Some locales use no-breaking space for LC_NUMBER, so return unicode for SizeToStr
has caused the Debian Bug report #750120,
regarding python-apt: Some locales use no-breaking space for LC_NUMBER, so return unicode for SizeToStr
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
750120: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=750120
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: python-apt
Version: 0.9.3.5
Severity: normal
Tags: upstream l10n patch

Dear Maintainer,

this is on Ubuntu, but this was the closest I could find to the python-apt
upstream :)

This is breaking the distribution upgrade on my girlfriends computer
(since she is using nn_NO.UTF8 as her language).

Ubuntu's upgrading python script is not expecting that the str returned
will have undecodeable chars. This could also be fixed at Ubuntu's
level, but looking at it, I thought it hit closer to home for
apt_pkg.size_to_str() to return a ready decoded unicode string to all
its users.


-- System Information:
Debian Release: jessie/sid
  APT prefers trusty-updates
  APT policy: (500, 'trusty-updates'), (500, 'trusty-security'), (500, 'trusty'), (100, 'trusty-backports')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.13.0-27-generic (SMP w/4 CPU cores)
Locale: LANG=nn_NO.UTF-8, LC_CTYPE=nn_NO.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages python-apt depends on:
ii  libapt-inst1.5     1.0.1ubuntu2
ii  libapt-pkg4.12     1.0.1ubuntu2
ii  libc6              2.19-0ubuntu6
ii  libgcc1            1:4.9-20140406-0ubuntu1
ii  libstdc++6         4.8.2-19ubuntu1
ii  python             2.7.5-5ubuntu3
ii  python-apt-common  0.9.3.5
pn  python:any         <none>

Versions of packages python-apt recommends:
ii  iso-codes    3.52-1
ii  lsb-release  4.1+Debian11ubuntu6
ii  xz-utils     5.1.1alpha+20120614-2ubuntu2

Versions of packages python-apt suggests:
pn  python-apt-dbg  <none>
pn  python-apt-doc  <none>
ii  python-gtk2     2.24.0-3ubuntu3
pn  python-vte      <none>

-- no debconf information
>From 1f482cbb9ebb2338cbe288613fc1554682a58637 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Odin=20H=C3=B8rthe=20Omdal?= <odinho@opera.com>
Date: Sun, 1 Jun 2014 21:05:23 +0200
Subject: [PATCH] Some locales use no-breaking space for text, so return
 unicode

---
 python/string.cc          |  3 ++-
 tests/test_size_to_str.py | 10 +++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/python/string.cc b/python/string.cc
index 9b02c93..006f102 100644
--- a/python/string.cc
+++ b/python/string.cc
@@ -86,7 +86,8 @@ PyObject *StrSizeToStr(PyObject *Self,PyObject *Args)
    // Check for OverflowErrors or other exceptions during conversion.
    if (PyErr_Occurred())
       return 0;
-   return CppPyString(SizeToStr(value));
+   std::string Str = SizeToStr(value)
+   return PyUnicode_FromStringAndSize(Str.c_str(),Str.length)
 }
 
 PyObject *StrQuoteString(PyObject *Self,PyObject *Args)
diff --git a/tests/test_size_to_str.py b/tests/test_size_to_str.py
index ba1e45b..c7b844d 100644
--- a/tests/test_size_to_str.py
+++ b/tests/test_size_to_str.py
@@ -91,13 +91,21 @@ class SizeToStrTestCase(unittest.TestCase):
 
 
 class RegressionTestCase(unittest.TestCase):
-    """Regression test for LP: #1030278"""
+    """Regression tests"""
 
     def test_no_overflow_error(self):
         # LP: #1030278 produces an overflow error in size_to_str() with a big
         # value under Python 3.
         self.assertEqual(apt_pkg.size_to_str(2147483648000000000000), '2147 E')
 
+    def test_expect_unicode(self):
+        import locale
+        old_locale = locale.getlocale()
+        locale.setlocale(locale.LC_ALL, 'nn_NO.utf8')
+        try:
+            self.assertEqual(apt_pkg.size_to_str(1000000), u'1\xa0000 k')
+        finally:
+            locale.setlocale(locale.LC_ALL, old_locale)
 
 if __name__ == "__main__":
     unittest.main()
-- 
1.9.1


--- End Message ---
--- Begin Message ---
Version: 2.1.0

On Sun, Jun 01, 2014 at 09:18:45PM +0200, Odin Hørthe Omdal wrote:
> Package: python-apt
> Version: 0.9.3.5
> Severity: normal
> Tags: upstream l10n patch
> 
> Dear Maintainer,
> 
> this is on Ubuntu, but this was the closest I could find to the python-apt
> upstream :)
> 
> This is breaking the distribution upgrade on my girlfriends computer
> (since she is using nn_NO.UTF8 as her language).
> 
> Ubuntu's upgrading python script is not expecting that the str returned
> will have undecodeable chars. This could also be fixed at Ubuntu's
> level, but looking at it, I thought it hit closer to home for
> apt_pkg.size_to_str() to return a ready decoded unicode string to all
> its users.

python-apt 2.1.0 removed Python 2 support, so this is no longer an
issue - we return unicode in Python 3.

-- 
debian developer - deb.li/jak | jak-linux.org - free software dev
ubuntu core developer                              i speak de, en

--- End Message ---

Reply to: