Patches item #1433198, was opened at 2006-02-16 16:56 Message generated for change (Comment added) made by gvanrossum You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1433198&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 Submitted By: Guido van Rossum (gvanrossum) Assigned to: M.-A. Lemburg (lemburg) Summary: restrict codec lookup to encodings package Initial Comment: Here's a fix for the problem recently mentioned on python-dev, where encoding names are looked up everywhere instead of just in the encodings package. It was slightly more work than I anticipated because there was a unit test that depended on the broken behavior. I've fixed the unittest with a hack that temporarily extends the encodings package's __path__ with sys.path, so that the test package will appear as a subpackage of the encodings package. That's not very clean; an alternative would be to patch sys.modules (but then less of the codec import machinery is exercised by the unit test) or to move the test codec to the encodings package (but that places some test code in a production package). What would you prefer? ---------------------------------------------------------------------- >Comment By: Guido van Rossum (gvanrossum) Date: 2006-02-19 10:01 Message: Logged In: YES user_id=6380 OK, so can this patch be applied or not? What are the consequences for the CJK codecs etc.? Please apply it yourself if the anwer is yes. (Don't backport yet.) ---------------------------------------------------------------------- Comment By: M.-A. Lemburg (lemburg) Date: 2006-02-17 11:16 Message: Logged In: YES user_id=38388 Sorry, wrong SF item... ---------------------------------------------------------------------- Comment By: M.-A. Lemburg (lemburg) Date: 2006-02-17 11:15 Message: Logged In: YES user_id=38388 See http://mail.python.org/pipermail/python-dev/2006-February/061230.html for details why I'm rejecting this patch. ---------------------------------------------------------------------- Comment By: M.-A. Lemburg (lemburg) Date: 2006-02-17 06:49 Message: Logged In: YES user_id=38388 Hmm, I think the right way would be to register a codec search function for the test codec rather than tweaking the encodings package to implement the old behavior again. This creates a precedent which others might follow to quickly get their code working again which would defeat the purpose of the whole patch: import codecs # Register a search function which knows about our codec def codec_search_function(encoding): if encoding == 'testcodec': from test import testcodec return tuple(testcodec.getregentry()) return None codecs.register(codec_search_function) # test codec's name (see test/testcodec.py) codecname = 'testcodec' Please also add a note to the NEWS file that we've changed the default codec lookup procedure in the encodings package search file. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1433198&group_id=5470 _______________________________________________ Patches mailing list [email protected] http://mail.python.org/mailman/listinfo/patches
