[Patches] [ python-Patches-1144636 ] Make urllib2.OpenerDirector instances pickle-able

SourceForge.net noreply at sourceforge.net
Wed Feb 14 11:27:25 CET 2007


Patches item #1144636, was opened at 2005-02-20 03:48
Message generated for change (Comment added) made by loewis
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1144636&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Library (Lib)
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: John J Lee (jjlee)
Assigned to: Nobody/Anonymous (nobody)
Summary: Make urllib2.OpenerDirector instances pickle-able

Initial Comment:
urllib2.OpenerDirector would be pickleable if it were
not for the fact that a couple of urllib2 handlers
(which build_opener() adds by default) have function
instance attributes.

It's trivial to replace these instance attributes with
a method that delegates to the appropriate function,
thus allowing pickling.


----------------------------------------------------------------------

>Comment By: Martin v. Löwis (loewis)
Date: 2007-02-14 11:27

Message:
Logged In: YES 
user_id=21627
Originator: NO

The patch doesn't fix the problem; the opener remains unpicklable. If you
are still interested in this patch, please revise it accordingly; if not,
please close it. When you revise it, please include a test case, like this
one:

    def test_1144636(self):
        # Make sure OpenerDirector instances can be pickled
        import pickle
        try:
            pickle.dumps(urllib2.build_opener())
        except pickle.PicklingError:
            self.fail("cannot pickle OpenerDirector instances")

----------------------------------------------------------------------

Comment By: John J Lee (jjlee)
Date: 2005-03-04 19:46

Message:
Logged In: YES 
user_id=261020

Hmm, maybe this fault (can't pickle) will be fixed without
need for this patch in 2.5, due to the change to unbound
methods that was discussed on python-dev.  I don't
understand that issue, so I can't say.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1144636&group_id=5470


More information about the Patches mailing list