summaryrefslogtreecommitdiffstats
path: root/Lib/pickle.py
diff options
context:
space:
mode:
authorAlexandre Vassalotti <alexandre@peadrop.com>2013-11-24 10:41:05 (GMT)
committerAlexandre Vassalotti <alexandre@peadrop.com>2013-11-24 10:41:05 (GMT)
commit4c05d3bc561dcdd70dd0d268fa769197334349a8 (patch)
treecb64c1535b23aa2904108d62f67a769ec415b974 /Lib/pickle.py
parentd606ba7f5579a152d8826e10cdc528af2a5c0e10 (diff)
downloadcpython-4c05d3bc561dcdd70dd0d268fa769197334349a8.zip
cpython-4c05d3bc561dcdd70dd0d268fa769197334349a8.tar.gz
cpython-4c05d3bc561dcdd70dd0d268fa769197334349a8.tar.bz2
Make built-in methods picklable through the reduce protocol.
Diffstat (limited to 'Lib/pickle.py')
-rw-r--r--Lib/pickle.py9
1 files changed, 1 insertions, 8 deletions
diff --git a/Lib/pickle.py b/Lib/pickle.py
index 8449340..d4aa13b 100644
--- a/Lib/pickle.py
+++ b/Lib/pickle.py
@@ -23,7 +23,7 @@ Misc variables:
"""
-from types import FunctionType, BuiltinFunctionType, ModuleType
+from types import FunctionType, ModuleType
from copyreg import dispatch_table
from copyreg import _extension_registry, _inverted_registry, _extension_cache
from itertools import islice
@@ -962,14 +962,7 @@ class _Pickler:
self.memoize(obj)
- def save_method(self, obj):
- if obj.__self__ is None or type(obj.__self__) is ModuleType:
- self.save_global(obj)
- else:
- self.save_reduce(getattr, (obj.__self__, obj.__name__), obj=obj)
-
dispatch[FunctionType] = save_global
- dispatch[BuiltinFunctionType] = save_method
dispatch[type] = save_global