[Bug 846044]

Simon McVittie 846044 at bugs.launchpad.net
Tue Oct 23 18:31:31 UTC 2012


I've applied those patches. Fixed in git for 1.1.2, unless you spot any
further problems.

(In reply to comment #11)
> * I'm not sure that you need the lambda in
> test_dbus_exception_convert_str_fail().

You do. In the older form of assertRaises, the thing that raises the
exception needs to be a callable, so that the exception isn't already
raised before it has a chance to wrap it in a "try:".

This is much nicer in the newer form, but I don't think that's a good
enough reason to require Python 2.7.

> * Can you provide some more detail about the weird up-chaining you're seeing
> with Exception.__unicode__?

It's really BaseException.__unicode__, which is this pseudocode:

    if self.__str__ isn't BaseException.__str__:
        return unicode(self.__str__())               # <---------

    if len(self.args) == 0:
        return ""

    if len(self.args) == 1:
        return unicode(self.args[0])

    # len(self.args) > 1
    return unicode(self.args)

The __str__ call will raise an exception if the message is non-ASCII but
the default codec is ASCII, so we lose.

My implementation of __unicode__ is a slightly more concise version of
the rest of that pseudocode - I'm essentially emulating what would
happen if we didn't have a __str__ method at all. We need __str__ for
Python 3, AIUI.

> * I'd probably swap this code around (I always dislike testing a negative
> when testing a positive will do just as well):
> 
> +        if self._dbus_error_name is not None:
> +            return '%s: %s' % (self._dbus_error_name, s)
> +        else:
> +            return s

It was already like that, and I tend to think of "is not None" as the
"positive" case - conceptually, I'm saying "if there is a
_dbus_error_name". I'd accept a patch to change both copies if you feel
strongly about this, though.

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to aptdaemon in Ubuntu.
https://bugs.launchpad.net/bugs/846044

Title:
  software-center crashed with UnicodeEncodeError in get_dbus_message():
  'ascii' codec can't encode character u'\xfc' in position 65: ordinal
  not in range(128)

Status in Aptdaemon:
  Fix Released
Status in Python Dbus:
  Confirmed
Status in “aptdaemon” package in Ubuntu:
  Fix Released
Status in “dbus-python” package in Ubuntu:
  In Progress
Status in “aptdaemon” source package in Oneiric:
  Fix Released
Status in “dbus-python” source package in Oneiric:
  Won't Fix
Status in “aptdaemon” source package in Quantal:
  Fix Released
Status in “dbus-python” source package in Quantal:
  In Progress

Bug description:
  I've tried to install an program. After clicking on "install" and
  entered password, the software center crashes.

  ProblemType: Crash
  DistroRelease: Ubuntu 11.10
  Package: software-center 4.1.22
  ProcVersionSignature: Ubuntu 3.0.0-10.16-generic-pae 3.0.4
  Uname: Linux 3.0.0-10-generic-pae i686
  NonfreeKernelModules: fglrx
  ApportVersion: 1.22.1-0ubuntu2
  Architecture: i386
  Date: Fri Sep  9 23:31:38 2011
  ExecutablePath: /usr/share/software-center/software-center
  InstallationMedia: Ubuntu 11.10 "Oneiric Ocelot" - Beta i386 (20110901)
  InterpreterPath: /usr/bin/python2.7
  PackageArchitecture: all
  ProcCmdline: /usr/bin/python /usr/bin/software-center
  ProcEnviron:
   PATH=(custom, no user)
   LANG=de_DE.UTF-8
   SHELL=/bin/bash
  PythonArgs: ['/usr/bin/software-center']
  SourcePackage: software-center
  Title: software-center crashed with UnicodeEncodeError in get_dbus_message(): 'ascii' codec can't encode character u'\xfc' in position 65: ordinal not in range(128)
  UpgradeStatus: No upgrade log present (probably fresh install)
  UserGroups: adm admin cdrom dialout lpadmin plugdev sambashare

To manage notifications about this bug go to:
https://bugs.launchpad.net/aptdaemon/+bug/846044/+subscriptions




More information about the foundations-bugs mailing list