[pypy-svn] pypy default: Fix for the failing test in test_typedef. The cause was ultimately
arigo
commits-noreply at bitbucket.org
Thu Mar 24 23:45:56 CET 2011
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r42924:3dbdd576be39
Date: 2011-03-24 23:44 +0100
http://bitbucket.org/pypy/pypy/changeset/3dbdd576be39/
Log: Fix for the failing test in test_typedef. The cause was ultimately
that the global _subclass_cache was populated with various
'config's, and now there was too many of them for the test to pass.
diff --git a/pypy/interpreter/typedef.py b/pypy/interpreter/typedef.py
--- a/pypy/interpreter/typedef.py
+++ b/pypy/interpreter/typedef.py
@@ -103,6 +103,7 @@
except KeyError:
subcls = _getusercls(config, cls, hasdict, wants_slots, needsdel,
weakrefable)
+ assert key not in _subclass_cache
_subclass_cache[key] = subcls
return subcls
get_unique_interplevel_subclass._annspecialcase_ = "specialize:memo"
diff --git a/pypy/interpreter/test/test_typedef.py b/pypy/interpreter/test/test_typedef.py
--- a/pypy/interpreter/test/test_typedef.py
+++ b/pypy/interpreter/test/test_typedef.py
@@ -127,12 +127,15 @@
checks[2], checks[3]))
subclasses = {}
for key, subcls in typedef._subclass_cache.items():
+ if key[0] is not space.config:
+ continue
cls = key[1]
subclasses.setdefault(cls, {})
- subclasses[cls][subcls] = True
+ prevsubcls = subclasses[cls].setdefault(subcls.__name__, subcls)
+ assert subcls is prevsubcls
for cls, set in subclasses.items():
assert len(set) <= 6, "%s has %d subclasses:\n%r" % (
- cls, len(set), [subcls.__name__ for subcls in set])
+ cls, len(set), list(set))
def test_getsetproperty(self):
class W_SomeType(Wrappable):
More information about the Pypy-commit
mailing list