Zachary Ware added the comment:
Note that pickling of the pure Python version of methodcaller works as expected:
Python 3.4.2 (default, Nov 20 2014, 12:40:10)
[GCC 4.8.3] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.modules['_operator'] = None
>>> import operator
>>> import pickle
>>> pickle.loads(pickle.dumps(operator.methodcaller('foo')))
<operator.methodcaller object at 0x7ff869945898>
The pure Python attrgetter and itemgetter don't work due to using functions
defined in __init__().
2.7 already raises TypeError on attempts to pickle any of the three.
----------
nosy: +zach.ware
title: Pickling of methodcaller and attrgetter -> Pickling of methodcaller,
attrgetter, and itemgetter
versions: +Python 3.4
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue22955>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com