From 97f59b96a215d81f2bfff72f05a6cce1df20eef0 Mon Sep 17 00:00:00 2001 From: Jozef Date: Thu, 9 Mar 2017 09:33:28 +0100 Subject: [PATCH] Fix regression in 0.13 that breaks old-style classes This is causing crashes with other (unrelated) classes that are old-style. --- bidict/_common.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bidict/_common.py b/bidict/_common.py index 2b52e4a..034504b 100644 --- a/bidict/_common.py +++ b/bidict/_common.py @@ -43,7 +43,11 @@ class BidirectionalMapping(Mapping): Causes conforming classes to be virtual subclasses automatically. """ if cls is BidirectionalMapping: - mro = C.__mro__ + try: + mro = C.__mro__ + except AttributeError: + # Old-style classes in Python 2.7 do not have the __mro__ attribute! + return False return all(any(B.__dict__.get(i) for B in mro) for i in cls._subclsattrs) return NotImplemented