classification
Title: ConfigParser exceptions are not pickleable
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.2, Python 3.3, Python 2.7
process
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
http://stackoverflow.com/questions/2246384/multiprocessing-pool-hangs-when-there-is-a-exception-in-any-of-the-thread

This appears to be another case of http://bugs.python.org/issue1692335

I also recently reported a similar problem at http://bugs.python.org/issue13751

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
http://hg.python.org/cpython/rev/e63e2471f46f

New changeset 76077971ee1f by Łukasz Langa in branch '3.2':
#13760: picklability tests for configparser exceptions
http://hg.python.org/cpython/rev/76077971ee1f
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
http://hg.python.org/cpython/rev/5ecf650ede7c
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 http://bugs.python.org/issue1692335 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.
History
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