Commit 14d9e84d authored by Armin Rigo's avatar Armin Rigo
Browse files

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.
parent ef06a997e7f1
...@@ -127,12 +127,15 @@ class TestTypeDef: ...@@ -127,12 +127,15 @@ class TestTypeDef:
checks[2], checks[3])) checks[2], checks[3]))
subclasses = {} subclasses = {}
for key, subcls in typedef._subclass_cache.items(): for key, subcls in typedef._subclass_cache.items():
if key[0] is not space.config:
continue
cls = key[1] cls = key[1]
subclasses.setdefault(cls, {}) subclasses.setdefault(cls, {})
subclasses[cls][subcls] = True prevsubcls = subclasses[cls].setdefault(subcls.__name__, subcls)
assert subcls is prevsubcls
for cls, set in subclasses.items(): for cls, set in subclasses.items():
assert len(set) <= 6, "%s has %d subclasses:\n%r" % ( 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): def test_getsetproperty(self):
class W_SomeType(Wrappable): class W_SomeType(Wrappable):
......
...@@ -103,6 +103,7 @@ def get_unique_interplevel_subclass(config, cls, hasdict, wants_slots, ...@@ -103,6 +103,7 @@ def get_unique_interplevel_subclass(config, cls, hasdict, wants_slots,
except KeyError: except KeyError:
subcls = _getusercls(config, cls, hasdict, wants_slots, needsdel, subcls = _getusercls(config, cls, hasdict, wants_slots, needsdel,
weakrefable) weakrefable)
assert key not in _subclass_cache
_subclass_cache[key] = subcls _subclass_cache[key] = subcls
return subcls return subcls
get_unique_interplevel_subclass._annspecialcase_ = "specialize:memo" get_unique_interplevel_subclass._annspecialcase_ = "specialize:memo"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment