Title: ConfigParser exceptions are not pickleable
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.2, Python 3.3, Python 2.7
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: lukasz.langa Nosy List: fmitha, lukasz.langa, python-dev
Priority: normal Keywords:

Created on 2012-01-11 07:50 by fmitha, last changed 2012-01-23 23:16 by lukasz.langa. This issue is now closed.

Messages (8)
msg151036 - (view) Author: Faheem Mitha (fmitha) Date: 2012-01-11 07:50
I have not experienced this myself, but see

This appears to be another case of

I also recently reported a similar problem at

Looking at the code for `NoOptionError` (see below) in 2.6 at least it would indeed be subject to the same problem. Perhaps some attention could be paid to 
resolving 1692335, which would presumably make this vexing problem go away?

class NoOptionError(Error):
    """A requested option was not found."""

    def __init__(self, option, section):
        Error.__init__(self, "No option %r in section: %r" %
                       (option, section))
        self.option = option
        self.section = section
msg151692 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-01-20 14:56
New changeset e63e2471f46f by Łukasz Langa in branch 'default':
#13760: picklability tests for configparser exceptions

New changeset 76077971ee1f by Łukasz Langa in branch '3.2':
#13760: picklability tests for configparser exceptions
msg151695 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-01-20 16:03
New changeset 5ecf650ede7c by Łukasz Langa in branch '2.7':
Fixes #13760: picklability of ConfigParser exceptions
msg151696 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2012-01-20 16:05
3.2 and 3.3 already worked as expected. For 2.7 I did the __reduce__ workaround that's also used by SQLAlchemy.
msg151704 - (view) Author: Faheem Mitha (fmitha) Date: 2012-01-20 18:23
Thanks for the quick attention to this, Lukasz. I'm just curious. Why do 3.2 and 3.3 already work? My understanding was that the basic exception issue in was still open.
msg151824 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2012-01-23 16:33
The reason why 3.2 and 3.3 work is that some time ago I fixed #4686 by explicitly settings .args in configparser exceptions. Unfortunately that patch was not backported at the time. I did that just now.

You're right, that is specific to configparser and doesn't affect #1692335 which is still unsolved.
msg151832 - (view) Author: Faheem Mitha (fmitha) Date: 2012-01-23 18:03
I see. Thanks for the pointer to the earlier (2008) bug report. I notice you fixed the bug differently for 2.7 (define __reduce__) and 3.2 (set args). Is there some reason for that?
msg151862 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2012-01-23 23:16
Currently both branches use the same solution to the problem (e.g. setting `args` in `__init__()`). I simply forgot about the old ticket when I prepared a fix for this one.
Date User Action Args
2012-01-23 23:16:30lukasz.langasetmessages: + msg151862
2012-01-23 18:03:37fmithasetmessages: + msg151832
2012-01-23 16:33:45lukasz.langasetmessages: + msg151824
2012-01-20 18:23:29fmithasetmessages: + msg151704
2012-01-20 16:05:14lukasz.langasetstatus: open -> closed
type: behavior
messages: + msg151696

resolution: fixed
stage: test needed -> resolved
2012-01-20 16:03:14python-devsetmessages: + msg151695
2012-01-20 14:56:19python-devsetnosy: + python-dev
messages: + msg151692
2012-01-14 03:49:38eric.araujosetassignee: lukasz.langa
stage: test needed

nosy: + lukasz.langa
versions: + Python 2.7, Python 3.2, Python 3.3, - Python 2.6
2012-01-11 07:50:12fmithacreate