[pypy-commit] pypy default: fix bug: when a newdict(instance=True) was switching its strategy, it lost its
Author: Carl Friedrich Bolz-Tereick Branch: Changeset: r96711:e19e79b1385f Date: 2019-05-28 12:22 +0200 http://bitbucket.org/pypy/pypy/changeset/e19e79b1385f/ Log:fix bug: when a newdict(instance=True) was switching its strategy, it lost its content diff --git a/pypy/objspace/std/dictmultiobject.py b/pypy/objspace/std/dictmultiobject.py --- a/pypy/objspace/std/dictmultiobject.py +++ b/pypy/objspace/std/dictmultiobject.py @@ -78,8 +78,9 @@ W_ModuleDictObject.__init__(w_obj, space, strategy, storage) return w_obj elif instance: -from pypy.objspace.std.mapdict import MapDictStrategy -strategy = space.fromcache(MapDictStrategy) +from pypy.objspace.std.mapdict import make_instance_dict +assert w_type is None +return make_instance_dict(space) elif strdict or module: assert w_type is None strategy = space.fromcache(BytesDictStrategy) diff --git a/pypy/objspace/std/mapdict.py b/pypy/objspace/std/mapdict.py --- a/pypy/objspace/std/mapdict.py +++ b/pypy/objspace/std/mapdict.py @@ -753,6 +753,7 @@ self.space = space def get_empty_storage(self): +# mainly used for tests w_result = Object() terminator = self.space.fromcache(get_terminator_for_dicts) w_result._mapdict_init_empty(terminator) @@ -865,6 +866,11 @@ def iteritems(self, w_dict): return MapDictIteratorItems(self.space, self, w_dict) +def make_instance_dict(space): +w_fake_object = Object() +terminator = space.fromcache(get_terminator_for_dicts) +w_fake_object._mapdict_init_empty(terminator) +return w_fake_object.getdict(space) def materialize_r_dict(space, obj, dict_w): map = obj._get_mapdict_map() diff --git a/pypy/objspace/std/test/test_mapdict.py b/pypy/objspace/std/test/test_mapdict.py --- a/pypy/objspace/std/test/test_mapdict.py +++ b/pypy/objspace/std/test/test_mapdict.py @@ -897,6 +897,17 @@ d = x.__dict__ assert list(__pypy__.reversed_dict(d)) == d.keys()[::-1] +def test_bug_materialize_huge_dict(self): +import __pypy__ +d = __pypy__.newdict("instance") +for i in range(100): +d[str(i)] = i +assert len(d) == 100 + +for key in d: +assert d[key] == int(key) + + class AppTestWithMapDictAndCounters(object): spaceconfig = {"objspace.std.withmethodcachecounter": True} ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: require binary vmprof since building from source requires libunwind on linux
Author: Matti Picus Branch: Changeset: r96709:bc4cf55dc154 Date: 2019-05-28 09:14 +0300 http://bitbucket.org/pypy/pypy/changeset/bc4cf55dc154/ Log:require binary vmprof since building from source requires libunwind on linux diff --git a/requirements.txt b/requirements.txt --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,5 @@ +--only-binary vmprof + cffi>=1.4.0 # parse log files in rvmprof tests ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.6: merge default into branch
Author: Matti Picus Branch: py3.6 Changeset: r96710:018e437e5061 Date: 2019-05-28 09:16 +0300 http://bitbucket.org/pypy/pypy/changeset/018e437e5061/ Log:merge default into branch diff --git a/pypy/module/pypyjit/test_pypy_c/test_ffi.py b/pypy/module/pypyjit/test_pypy_c/test_ffi.py --- a/pypy/module/pypyjit/test_pypy_c/test_ffi.py +++ b/pypy/module/pypyjit/test_pypy_c/test_ffi.py @@ -425,9 +425,11 @@ setarrayitem_raw(i153, 0, i106, descr=...) p156 = getfield_gc_r(p48, descr=...) i158 = getfield_raw_i(..., descr=...) +i160 = int_sub(i158, 16) +setfield_raw(#, i160, descr=...) setfield_gc(p48, p49, descr=...) setfield_gc(p134, ConstPtr(null), descr=...) -i160 = int_lt(i158, 0) +i160 = int_lt(i160, 0) guard_false(i160, descr=...) jump(..., descr=...) """) diff --git a/requirements.txt b/requirements.txt --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,5 @@ +--only-binary vmprof + cffi>=1.4.0 # parse log files in rvmprof tests diff --git a/rpython/tool/jitlogparser/parser.py b/rpython/tool/jitlogparser/parser.py --- a/rpython/tool/jitlogparser/parser.py +++ b/rpython/tool/jitlogparser/parser.py @@ -504,8 +504,10 @@ for line in lines: if line: num, count = line.split(':', 2) -mapping[num].count = int(count) - +try: +mapping[num].count = int(count) +except KeyError: +pass # too bad def mangle_descr(descr): if descr.startswith('TargetToken('): diff --git a/testrunner/get_info.py b/testrunner/get_info.py --- a/testrunner/get_info.py +++ b/testrunner/get_info.py @@ -10,8 +10,7 @@ BASE_DIR = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) if sys.platform.startswith('win'): TARGET_NAME = r'pypy3-c.exe' -# see https://github.com/pypa/virtualenv/issues/789 -TARGET_DIR = 'bin' +TARGET_DIR = 'Scripts' else: TARGET_NAME = 'pypy3-c' TARGET_DIR = 'bin' ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit