summaryrefslogtreecommitdiff
path: root/compat.py
diff options
context:
space:
mode:
authorEmile Anclin <emile.anclin@logilab.fr>2010-11-22 11:21:36 +0100
committerEmile Anclin <emile.anclin@logilab.fr>2010-11-22 11:21:36 +0100
commitd85bbf8300eefb13f6b0c31f8eec7792a873a738 (patch)
tree2e56607f91678d32adedca2783a1c8a897cada2a /compat.py
parent7c554f40aa1f4c8d99e742fa1088db2756a110ee (diff)
downloadlogilab-common-d85bbf8300eefb13f6b0c31f8eec7792a873a738.tar.gz
fix tests
Diffstat (limited to 'compat.py')
-rw-r--r--compat.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/compat.py b/compat.py
index 41501d3..eb5ec11 100644
--- a/compat.py
+++ b/compat.py
@@ -88,11 +88,9 @@ if sys.version_info < (3, 0):# 2to3 will remove the imports
imap = deprecated('imap exists in itertools since py2.3')(imap)
chain = deprecated('chain exists in itertools since py2.3')(chain)
-set = deprecated('set exists in builtins since py2.4')(set)
-frozenset = deprecated('frozenset exists in builtins since py2.4')(frozenset)
sum = deprecated('sum exists in builtins since py2.3')(sum)
enumerate = deprecated('enumerate exists in builtins since py2.3')(enumerate)
-set = deprecated('set exists in builtins since py2.4')(set)
+frozenset = deprecated('frozenset exists in builtins since py2.4')(frozenset)
reversed = deprecated('reversed exists in builtins since py2.4')(reversed)
sorted = deprecated('sorted exists in builtins since py2.4')(sorted)
max = deprecated('max exists in builtins since py2.4')(max)
@@ -196,17 +194,20 @@ except ImportError: # python < 2.6
return curdir
return join(*rel_list)
+
+# XXX don't know why tests don't pass if I don't do that :
+_real_set, set = set, deprecated('set exists in builtins since py2.4')(set)
if (2, 5) <= sys.version_info[:2]:
- InheritableSet = set
+ InheritableSet = _real_set
else:
- class InheritableSet(set):
+ class InheritableSet(_real_set):
"""hacked resolving inheritancy issue from old style class in 2.4"""
def __new__(cls, *args, **kwargs):
if args:
new_args = (args[0], )
else:
new_args = ()
- obj = set.__new__(cls, *new_args)
+ obj = _real_set.__new__(cls, *new_args)
obj.__init__(*args, **kwargs)
return obj