Patches item #1144636, was opened at 2005-02-20 02:48 Message generated for change (Comment added) made by jjlee 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: Closed 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: John J Lee (jjlee) Date: 2007-02-14 21:43 Message: Logged In: YES user_id=261020 Originator: YES I am no longer convinced that the intended change is an improvement, so I am closing this tracker item. FWIW, mysteriously, your unit test always *passes* for me (both before and after applying the patch). (And before svn updating from roughly rev 53200, your unit test fails for me before applying the patch, and passes for me after applying the patch.) For the record, the reasons I'm no longer convinced that pickle-ability of urllib2.OpenerDirector instances is a good thing are: 1. I don't think a pickle-ability constraint should be imposed on subtypes 2. I'm not convinced now that the ability to pickle these instances is terribly useful (although I did file the patch as a result of a user request) ---------------------------------------------------------------------- Comment By: Martin v. Löwis (loewis) Date: 2007-02-14 10: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 18: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 _______________________________________________ Patches mailing list Patches@python.org http://mail.python.org/mailman/listinfo/patches