[Patches] [ python-Patches-1433198 ] restrict codec lookup to encodings package

SourceForge.net noreply at sourceforge.net
Thu Feb 16 22:56:43 CET 2006


Patches item #1433198, was opened at 2006-02-16 16:56
Message generated for change (Tracker Item Submitted) made by Item Submitter
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?

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

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


More information about the Patches mailing list