diff options
author | Guido van Rossum <guido@python.org> | 2003-02-13 16:30:16 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2003-02-13 16:30:16 (GMT) |
commit | 298e4214538a7196c27ec22b1f01506fdb3c4039 (patch) | |
tree | 6d75d061df43965e30b132c378802c5488fd8f64 /Lib/test | |
parent | 0c016a9590b3da47f19420d0616e0c72cae19abf (diff) | |
download | cpython-298e4214538a7196c27ec22b1f01506fdb3c4039.zip cpython-298e4214538a7196c27ec22b1f01506fdb3c4039.tar.gz cpython-298e4214538a7196c27ec22b1f01506fdb3c4039.tar.bz2 |
SF patch #685738 by Michael Stone.
This changes the default __new__ to refuse arguments iff tp_init is the
default __init__ implementation -- thus making it a TypeError when you
try to pass arguments to a constructor if the class doesn't override at
least __init__ or __new__.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_descr.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py index 77bf61a..ffd86bc 100644 --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -3694,8 +3694,8 @@ def subclass_right_op(): def __rdiv__(self, other): return "C.__rdiv__" - vereq(C(1) / 1, "C.__div__") - vereq(1 / C(1), "C.__rdiv__") + vereq(C() / 1, "C.__div__") + vereq(1 / C(), "C.__rdiv__") # Case 3: subclass of new-style class; here it gets interesting @@ -3705,8 +3705,8 @@ def subclass_right_op(): def __rdiv__(self, other): return "D.__rdiv__" - vereq(D(1) / C(1), "D.__div__") - vereq(C(1) / D(1), "D.__rdiv__") + vereq(D() / C(), "D.__div__") + vereq(C() / D(), "D.__rdiv__") # Case 4: this didn't work right in 2.2.2 and 2.3a1 @@ -3715,10 +3715,10 @@ def subclass_right_op(): vereq(E.__rdiv__, C.__rdiv__) - vereq(E(1) / 1, "C.__div__") - vereq(1 / E(1), "C.__rdiv__") - vereq(E(1) / C(1), "C.__div__") - vereq(C(1) / E(1), "C.__div__") # This one would fail + vereq(E() / 1, "C.__div__") + vereq(1 / E(), "C.__rdiv__") + vereq(E() / C(), "C.__div__") + vereq(C() / E(), "C.__div__") # This one would fail def dict_type_with_metaclass(): if verbose: |