[issue22955] Pickling of methodcaller and attrgetter

2014-11-27 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
nosy: +pitrou, serhiy.storchaka
type:  - enhancement
versions: +Python 3.5 -Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22955
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22955] Pickling of methodcaller and attrgetter

2014-11-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I think this issue needs different solutions for 3.5 and maintained releases. 
We can implement the pickling of methodcaller, attrgetter and itemgetter in 3.5 
(I agree this is good idea). And it would be good if pickling of these types 
will raise an exception in maintained releases.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22955
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22955] Pickling of methodcaller and attrgetter

2014-11-27 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
assignee:  - serhiy.storchaka

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22955
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22955] Pickling of methodcaller and attrgetter

2014-11-26 Thread Antony Lee

New submission from Antony Lee:

methodcaller and attrgetter objects seem to be picklable, but in fact the 
pickling is erroneous:

 import operator, pickle
 pickle.loads(pickle.dumps(operator.methodcaller(foo)))
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: methodcaller needs at least one argument, the method name
 pickle.loads(pickle.dumps(operator.attrgetter(foo)))
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: attrgetter expected 1 arguments, got 0

When looking at the pickle disassembly, it seems that the argument to the 
constructor is indeed not pickled.

 import pickletools; 
 pickletools.dis(pickle.dumps(operator.methodcaller(foo)))
0: \x80 PROTO  3
2: cGLOBAL 'operator methodcaller'
   25: qBINPUT 0
   27: )EMPTY_TUPLE
   28: \x81 NEWOBJ
   29: qBINPUT 1
   31: .STOP
highest protocol among opcodes = 2

--
components: Library (Lib)
messages: 231752
nosy: Antony.Lee
priority: normal
severity: normal
status: open
title: Pickling of methodcaller and attrgetter
versions: Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22955
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22955] Pickling of methodcaller and attrgetter

2014-11-26 Thread Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


--
stage:  - needs patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22955
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com