Author: Armin Rigo <[email protected]>
Branch: fix-descrmismatch-crash
Changeset: r97769:8c25c3e5ab7d
Date: 2019-10-14 11:06 +0200
http://bitbucket.org/pypy/pypy/changeset/8c25c3e5ab7d/
Log: frozenset.__init__() does nothing on CPython, and can be called with
random arguments.
diff --git a/pypy/interpreter/test/test_gateway.py
b/pypy/interpreter/test/test_gateway.py
--- a/pypy/interpreter/test/test_gateway.py
+++ b/pypy/interpreter/test/test_gateway.py
@@ -1014,7 +1014,7 @@
def test_fast_path_crash(self):
# issue bb-3091 crash in BuiltinCodePassThroughArguments0.funcrun
- for obj in (dict, set, frozenset):
+ for obj in (dict, set):
with raises(TypeError) as excinfo:
if self.runappdirect:
msg_fmt = "'%s' object but received a '%s'"
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
@@ -578,11 +578,6 @@
class W_FrozensetObject(W_BaseSetObject):
hash = 0
- #overridden here so the error is reported correctly
- def __init__(self, space, w_iterable=None):
- """Initialize the frozenset by taking ownership of 'setdata'."""
- W_BaseSetObject.__init__(self, space, w_iterable)
-
def _cleanup_(self):
# in case there are frozenset objects existing during
# translation, make sure we don't translate a cached hash
@@ -650,7 +645,6 @@
Build an immutable unordered collection.""",
__new__ = gateway.interp2app(W_FrozensetObject.descr_new2),
- __init__ = gateway.interp2app(W_FrozensetObject.descr_init),
__repr__ = gateway.interp2app(W_BaseSetObject.descr_repr),
__hash__ = gateway.interp2app(W_FrozensetObject.descr_hash),
__cmp__ = gateway.interp2app(W_BaseSetObject.descr_cmp),
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
@@ -1037,3 +1037,8 @@
raise ValueError
yield 1
raises(ValueError, set, f())
+
+ def test_frozenset_init_does_nothing(self):
+ f = frozenset([1, 2, 3])
+ f.__init__(4, 5, 6)
+ assert f == frozenset([1, 2, 3])
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit