diff options
author | Guido van Rossum <guido@python.org> | 2003-02-07 14:59:13 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2003-02-07 14:59:13 (GMT) |
commit | f6318594095b8dce5074030ec307c285a631bb65 (patch) | |
tree | 15bba78a67d5d0427a0f97f3e38bda5ad04f4bb0 | |
parent | 693aea2eb4b30324b1e99ce9b18509e77361121e (diff) | |
download | cpython-f6318594095b8dce5074030ec307c285a631bb65.zip cpython-f6318594095b8dce5074030ec307c285a631bb65.tar.gz cpython-f6318594095b8dce5074030ec307c285a631bb65.tar.bz2 |
Add __getnewargs__ method to classes that need it.
(Yes, this is an incompatibility. I'll document it in PEP 307.)
-rw-r--r-- | Lib/test/test_descr.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py index da4bd03..8a6a538 100644 --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -2698,6 +2698,8 @@ def pickles(): class C1(list): def __new__(cls, a, b): return super(C1, cls).__new__(cls) + def __getnewargs__(self): + return (self.a, self.b) def __init__(self, a, b): self.a = a self.b = b @@ -2708,6 +2710,8 @@ def pickles(): class C2(int): def __new__(cls, a, b, val=0): return super(C2, cls).__new__(cls, val) + def __getnewargs__(self): + return (self.a, self.b, int(self)) def __init__(self, a, b, val=0): self.a = a self.b = b |