changeset 1019:ad96321e4d2b trunk

Work around for Python 3.4 regression in pickle (http://bugs.python.org/issue16251).
author hodgestar
date Sun, 16 Feb 2014 17:29:31 +0000
parents 38565f2ab970
children 6c1d10d2fc52
files genshi/core.py
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/genshi/core.py
+++ b/genshi/core.py
@@ -664,7 +664,13 @@
 
     def __getitem__(self, name):
         return QName(self.uri + '}' + name)
-    __getattr__ = __getitem__
+
+    def __getattr__(self, name):
+        # work around for pickle bug in Python 3.4
+        # see http://bugs.python.org/issue16251
+        if name == "__getnewargs_ex__":
+            raise AttributeError("%r has no attribute %r" % (type(self), name))
+        return self.__getitem__(name)
 
     def __hash__(self):
         return hash(self.uri)
Copyright (C) 2012-2017 Edgewall Software