[pypy-commit] pypy value-profiling: fix interaction of known class lists and cpyext
cfbolz
pypy.commits at gmail.com
Sat Jan 23 01:51:47 EST 2016
Author: Carl Friedrich Bolz <cfbolz at gmx.de>
Branch: value-profiling
Changeset: r81923:f66ef9ad7656
Date: 2016-01-22 17:47 +0100
http://bitbucket.org/pypy/pypy/changeset/f66ef9ad7656/
Log: fix interaction of known class lists and cpyext
diff --git a/pypy/objspace/std/listobject.py b/pypy/objspace/std/listobject.py
--- a/pypy/objspace/std/listobject.py
+++ b/pypy/objspace/std/listobject.py
@@ -88,6 +88,10 @@
return space.fromcache(EmptyListStrategy)
w_firstobj = list_w[0]
+ if w_firstobj is None:
+ # this is done by cpyext:
+ return space.fromcache(ObjectListStrategy)
+
check_int_or_float = False
if type(w_firstobj) is W_IntObject:
diff --git a/pypy/objspace/std/test/test_listobject.py b/pypy/objspace/std/test/test_listobject.py
--- a/pypy/objspace/std/test/test_listobject.py
+++ b/pypy/objspace/std/test/test_listobject.py
@@ -417,6 +417,13 @@
assert isinstance(w_lst.strategy, SizeListStrategy)
assert w_lst.strategy.sizehint == 13
+ def test_newlist_with_interplevel_None(self):
+ # needed for cpyext
+ space = self.space
+ w_lst = space.newlist([None] * 10)
+ assert w_lst.strategy._known_cls is None
+
+
def test_find_fast_on_intlist(self, monkeypatch):
monkeypatch.setattr(self.space, "eq_w", None)
w = self.space.wrap
More information about the pypy-commit
mailing list