bzr crashed with AttributeError in stopTest(): '_TypeEqualityDict' object has no attribute 'clear' - breaks bzr selftest on oneiric

Bug #809048 reported by Jean-Louis Dupond on 2011-07-11
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bazaar
Critical
Jelmer Vernooij
Python
Fix Released
Unknown
bzr (Ubuntu)
High
Jelmer Vernooij

Bug Description

Getting this error when trying to compile cia-clients

https://bugs.launchpad.net/bugs/808749

ProblemType: Crash
DistroRelease: Ubuntu 11.10
Package: bzr 2.4.0~beta4-4ubuntu2
ProcVersionSignature: Ubuntu 3.0.0-4.5-generic 3.0.0-rc6
Uname: Linux 3.0.0-4-generic x86_64
Architecture: amd64
BzrDebugFlags: set()
BzrVersion: 2.4b4
CommandLine: ['/usr/bin/bzr', 'selftest', '-v', '-s', 'bp.cia']
CrashDb: bzr
Date: Tue Jul 12 00:29:07 2011
ExecutablePath: /usr/bin/bzr
FileSystemEncoding: UTF-8
InstallationMedia: Ubuntu 11.04 "Natty Narwhal" - Alpha amd64 (20110119)
InterpreterPath: /usr/bin/python2.7
Locale: nl_BE.UTF-8
PackageArchitecture: all
Platform: Linux-3.0.0-4-generic-x86_64-with-Ubuntu-11.10-oneiric
ProcCmdline: /usr/bin/python /usr/bin/bzr selftest -v -s bp.cia
ProcEnviron:
 SHELL=/bin/bash
 LC_MESSAGES=nl_BE.utf8
 LANG=nl_BE.UTF-8
 LANGUAGE=nl_BE:nl:en_GB:en
PythonVersion: 2.7.2
SourcePackage: bzr
Title: bzr crashed with AttributeError in stopTest(): '_TypeEqualityDict' object has no attribute 'clear'
UpgradeStatus: Upgraded to oneiric on 2011-06-18 (23 days ago)
UserEncoding: UTF-8
UserGroups: adm admin audio cdrom dialout fuse libvirtd lpadmin netdev plugdev sambashare sbuild video

Related branches

Jean-Louis Dupond (dupondje) wrote :
visibility: private → public
Andrew Bennetts (spiv) wrote :

oneiric's Python 2.7 is using an (unreleased) version of unittest which changes the behaviour of TestCase._type_equality_funcs a little. That's fine, in that it's supposed to be a private variable, but bzr is poking at it to try stop used TestCase instances from wasting memory.

bzr needs to become a little more careful in how it pokes at the private variable, and also be adjusted to poke it slightly differently so it will work with Python 2.7.3 (and oneiric's patched 2.7.2).

Changed in bzr:
assignee: nobody → canonical-bazaar (canonical-bazaar)
importance: Undecided → High
status: New → Confirmed
Andrew Bennetts (spiv) wrote :

I suppose alternatively we could try to get upstream to add a 'clear' method to the _TypeEqualityDict class before 2.7.3 is released.

Martin Packman (gz) wrote :

Upstream change is:
<http://hg.python.org/cpython/rev/9c337a4c650d/>

At least with that unittest stops storing bound methods in the dict, so the best upstream change would be to also rename the variable from `_type_equality_funcs` to `_type_equality_func_names` or similar. Perhaps Michael Foord could be persuaded to land such a change without me having to go through the pain of being yelled at for breaking the underscore taboo?

Changed in bzr (Ubuntu):
status: New → Confirmed
importance: Undecided → High
tags: removed: need-duplicate-check
Martin Packman (gz) wrote :

Actually, it's not quite that easy as there's now a straight _TypeEqualityDict<->TestCase reference link. I'll see if I can get upstream to accept some kind of fix.

Martin [gz] wrote:
> Actually, it's not quite that easy as there's now a straight
> _TypeEqualityDict<->TestCase reference link. I'll see if I can get
> upstream to accept some kind of fix.

In the interim we could add some ugly code to handle both versions:

    tef_clear = getattr(type_equality_funcs, "clear", None):
    if tef_clear is None:
        tef_instance_dict = getattr(type_equality_funcs, "__dict__", None)
        if tef_instance_dict is not None:
     tef_clear = tef_instance_dict.clear
    if tef_clear is not None:
        tef_clear()

Or perhaps we should just set the entire attribute to None, if it exists, and
rely on the assumption that by the time we do this self.assertEqual isn't going
to be invoked again:

    sentinel = object()
    if getattr(self, '_type_equality_funcs', sentinel) is not sentinel:
        self._type_equality_funcs = None

-Andrew.

Changed in python:
status: Unknown → Fix Released

This is preventing the upload of bzr 2.4b5 to oneiric at the moment.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package bzr - 2.4.0~beta5-2ubuntu1

---------------
bzr (2.4.0~beta5-2ubuntu1) oneiric; urgency=low

  * Merge from Debian. Remaining changes:
   + Drop build dependencies on python-{subunit,meliae,lzma,medusa}, which are
     not in main.
   + Disable support for running selftest in parallel (requires subunit).
  * Fix compatibility with newer versions of Python 2.7. LP: #809048
 -- Jelmer Vernooij <email address hidden> Thu, 14 Jul 2011 18:18:11 +0200

Changed in bzr (Ubuntu):
status: Confirmed → Fix Released
Martin Pool (mbp) wrote :

escalating to critical as a blocker for 2.4.0

could we merge the workaround for this into bzr 2.4?

Changed in bzr:
importance: High → Critical
milestone: none → 2.4.0
Jelmer Vernooij (jelmer) on 2011-08-09
Changed in bzr (Ubuntu):
assignee: nobody → Jelmer Vernooij (jelmer)
Martin Pool (mbp) on 2011-08-09
summary: bzr crashed with AttributeError in stopTest(): '_TypeEqualityDict'
- object has no attribute 'clear'
+ object has no attribute 'clear' - breaks bzr selftest on oneiric
Jelmer Vernooij (jelmer) on 2011-08-09
Changed in bzr:
assignee: canonical-bazaar (canonical-bazaar) → Jelmer Vernooij (jelmer)
status: Confirmed → In Progress
Vincent Ladeuil (vila) on 2011-08-11
Changed in bzr:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.