Author: Carl Friedrich Bolz <cfb...@gmx.de> Branch: Changeset: r80503:175220886e4c Date: 2015-11-02 21:32 +0100 http://bitbucket.org/pypy/pypy/changeset/175220886e4c/
Log: hopefully fix the set failures (there's some weird other problem) diff --git a/pypy/objspace/std/setobject.py b/pypy/objspace/std/setobject.py --- a/pypy/objspace/std/setobject.py +++ b/pypy/objspace/std/setobject.py @@ -1651,12 +1651,19 @@ w_set.sstorage = strategy.get_empty_storage() tp = space.type(w_iterable) - for w_item in space.iteriterable(w_iterable): + + w_iter = space.iter(w_iterable) + while True: + try: + w_item = space.next(w_iter) + except OperationError, e: + if not e.match(space, space.w_StopIteration): + raise + return create_set_driver.jit_merge_point(tp=tp, strategy=w_set.strategy) w_set.add(w_item) - init_signature = Signature(['some_iterable'], None, None) init_defaults = [None] def _initialize_set(space, w_obj, w_iterable=None): diff --git a/pypy/objspace/std/test/test_setobject.py b/pypy/objspace/std/test/test_setobject.py --- a/pypy/objspace/std/test/test_setobject.py +++ b/pypy/objspace/std/test/test_setobject.py @@ -996,3 +996,9 @@ s = set([1, 2, 3]) s.intersection_update(set()) assert strategy(s) == "EmptySetStrategy" + + def test_weird_exception_from_iterable(self): + def f(): + raise ValueError + yield 1 + raises(ValueError, set, f()) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit