Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Bugs

[issue6395] Add Pickle Support to the codecs Module

 

 

Python bugs RSS feed   Index | Next | Previous | View Threaded


report at bugs

Jul 1, 2009, 9:02 AM

Post #1 of 4 (303 views)
Permalink
[issue6395] Add Pickle Support to the codecs Module

Changes by Benjamin Peterson <benjamin [at] python>:


----------
type: crash -> feature request
versions: +Python 2.7, Python 3.2 -Python 2.5, Python 2.6

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue6395>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Jul 1, 2009, 8:46 AM

Post #2 of 4 (273 views)
Permalink
[issue6395] Add Pickle Support to the codecs Module [In reply to]

New submission from ThomasH <thomas.bugzilla [at] gmx>:

I recently ran into an infinite recursion trying to unpickle a
codecs.StreamWriter object (I presume the issue would be the same for a
StreamReader).

Here is the end of the stack trace:

  File "/sw/lib/python2.5/codecs.py", line 330, in __getattr__   
    return getattr(self.stream, name)
  File "/sw/lib/python2.5/codecs.py", line 330, in __getattr__ 
    return getattr(self.stream, name) 
  File "/sw/lib/python2.5/codecs.py", line 330, in __getattr__ 
    return getattr(self.stream, name) 
RuntimeError: maximum recursion depth exceeded

The issue is the same under Python2.6 but the error output has changed
(see http://bugs.python.org/issue5508).

The problem is that the codecs module tries to delegate member lookup to
the underlying stream. But after unpickling, "self.stream" is not
defined, so the reference to self.stream in __getattr__ itself leads to
an invocation of __getattr__ - hence the recursion loop.

Using tools from the Pickle protocol, like __getstate__/__setstate__,
could help degrade codecs objects gracefully during pickle/unpickle
cycles. E.g. it might be enough to provide a dummy self.stream through
__setstate__.

----------
components: Library (Lib)
messages: 89985
nosy: ThomasH
severity: normal
status: open
title: Add Pickle Support to the codecs Module
type: crash
versions: Python 2.5, Python 2.6

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue6395>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Jul 2, 2009, 5:03 PM

Post #3 of 4 (276 views)
Permalink
[issue6395] Add Pickle Support to the codecs Module [In reply to]

Changes by Alexandre Vassalotti <alexandre [at] peadrop>:


----------
nosy: +alexandre.vassalotti

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue6395>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Jul 6, 2009, 7:26 AM

Post #4 of 4 (254 views)
Permalink
[issue6395] Add Pickle Support to the codecs Module [In reply to]

Marc-Andre Lemburg <mal [at] egenix> added the comment:

I don't understand the use case for this.

If the StreamWriter/Reader cannot pickle the underlying stream (which is
probably always the case), why should the object itself be pickleable ?

What we could do is implement .__get/setstate__() and have it raise an
exception to inform the user of the problem.

----------
nosy: +lemburg

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue6395>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com

Python bugs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.