[issue1398] Can't pickle partial functions

2011-12-10 Thread Jesús Cea Avión

Changes by Jesús Cea Avión j...@jcea.es:


--
nosy: +jcea

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



[issue1398] Can't pickle partial functions

2009-12-11 Thread Alexandre Vassalotti

Alexandre Vassalotti alexan...@peadrop.com added the comment:

Indeed. Jack Diederich added support for pickling partial functions in
r70931.

--
resolution:  - fixed
stage:  - committed/rejected
status: open - closed

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



[issue1398] Can't pickle partial functions

2009-12-03 Thread flox

flox la...@yahoo.fr added the comment:

It seems fixed on trunk.
It is fixed on Python 3.1 and 3.2, too.


With Python 2.6 I see the error:
 ./python partial_bug.py
TypeError: can't pickle partial objects


Documentation for trunk and py3k is OK?

--
nosy: +flox

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



[issue1398] Can't pickle partial functions

2008-08-15 Thread Nicolas Grilly

Nicolas Grilly [EMAIL PROTECTED] added the comment:

It seems using protocol version 2 is not enough:

 s = pickle.dumps(partial_f, 2)
 f = pickle.loads(s)
Traceback (most recent call last):
...
TypeError: type 'partial' takes at least one argument

Am I missing something?

--
nosy: +ngrilly

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1398
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1398] Can't pickle partial functions

2008-08-15 Thread Alexandre Vassalotti

Alexandre Vassalotti [EMAIL PROTECTED] added the comment:

I agree that this a bug. However, the liberal functools.partial
constructor makes it hard to pickle partial instances correctly.
Ideally, we would add the __getnewargs__ special method and be done with
it. But, this won't work in this case due to the *args and **kwargs
arguments of partial. Since pickle supports neither, we would need to
use apply(), which going to be removed in Python 3.0, as follow:

 import pickletools

pickletools.dis(c__builtin__\napply\n(cfunctools\npartial\n(c__main__\nf\nt(S'b'\nK\x01dtR.)
0: cGLOBAL '__builtin__ apply'
   19: (MARK
   20: cGLOBAL 'functools partial'
   39: (MARK
   40: cGLOBAL '__main__ f'
   52: tTUPLE  (MARK at 39)
   53: (MARK
   54: SSTRING 'b'
   59: KBININT11
   61: dDICT   (MARK at 53)
   62: tTUPLE  (MARK at 19)
   63: RREDUCE
   64: .STOP

Unfortunately, pickle.Pickler cannot generate a such pickle stream. So
this bug is symptom of the bigger issue that classes with *args and/or
**kwargs argument cannot be made picklable.

--
nosy: +alexandre.vassalotti
priority:  - normal
resolution: invalid - 
status: closed - open

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1398
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1398] Can't pickle partial functions

2007-11-08 Thread Christian Heimes

Changes by Christian Heimes:


--
resolution:  - invalid
status: open - closed

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1398
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1398] Can't pickle partial functions

2007-11-08 Thread Stefan Sonnenberg-Carstens

Stefan Sonnenberg-Carstens added the comment:

You are using an old protocol version

pickle.dumps(partial_f,2)

does the trick:

 pickle.dumps(partial_f,2)
'\x80\x02cfunctools\npartial\nq\x00)\x81q\x01}q\x02b.'

--
nosy: +pythonmeister

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1398
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1398] Can't pickle partial functions

2007-11-07 Thread Daniel

New submission from Daniel:

Creating a function using functools.partial results in a function which
cannot be pickled.

Attached is a small testcase.

--
components: Library (Lib)
files: partial_bug.py
messages: 57200
nosy: danhs
severity: normal
status: open
title: Can't pickle partial functions
type: behavior
versions: Python 2.5
Added file: http://bugs.python.org/file8705/partial_bug.py

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1398
__from functools import partial
import pickle


def f(a, b):
print a, b

partial_f = partial(f, b = 'hello')


pickle.dumps(partial_f)___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com