diff options
author | Guido van Rossum <guido@python.org> | 2003-01-28 22:31:25 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2003-01-28 22:31:25 (GMT) |
commit | 4e2491dbb132ec6327c1d3327878ea69bc938c1b (patch) | |
tree | c78e39a7fb52254097408b063609e11f57ee5a5e /Lib/pickle.py | |
parent | b26a97aa50171771bb9833f22231494520d2e403 (diff) | |
download | cpython-4e2491dbb132ec6327c1d3327878ea69bc938c1b.zip cpython-4e2491dbb132ec6327c1d3327878ea69bc938c1b.tar.gz cpython-4e2491dbb132ec6327c1d3327878ea69bc938c1b.tar.bz2 |
Add a comment about how some built-in types should grow a
__getnewargs__ method.
Diffstat (limited to 'Lib/pickle.py')
-rw-r--r-- | Lib/pickle.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/pickle.py b/Lib/pickle.py index 9a5747e..b9bafce 100644 --- a/Lib/pickle.py +++ b/Lib/pickle.py @@ -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),) |