]> granicus.if.org Git - python/commitdiff
Add a comment about how some built-in types should grow a
authorGuido van Rossum <guido@python.org>
Tue, 28 Jan 2003 22:31:25 +0000 (22:31 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 28 Jan 2003 22:31:25 +0000 (22:31 +0000)
__getnewargs__ method.

Lib/pickle.py

index 9a5747e8429c71de1a6aaf19a269667831aefa1b..b9bafce964ba8024ccdd7c1f2c0fe6435d0418fd 100644 (file)
@@ -368,13 +368,15 @@ class Pickler:
 
     def save_newobj(self, obj):
         # Save a new-style class instance, using protocol 2.
-        # XXX Much of this is still experimental.
+        # XXX This is still experimental.
         assert self.proto >= 2          # This only works for protocol 2
         t = type(obj)
         getnewargs = getattr(obj, "__getnewargs__", None)
         if getnewargs:
             args = getnewargs()         # This bette not reference obj
         else:
+            # XXX These types should each grow a __getnewargs__
+            # implementation so this special-casing is unnecessary.
             for cls in int, long, float, complex, str, UnicodeType, tuple:
                 if cls and isinstance(obj, cls):
                     args = (cls(obj),)