File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ def search_function(encoding):
9191 if not modname :
9292 continue
9393 try :
94- mod = __import__ (modname ,
94+ mod = __import__ ('encodings.' + modname ,
9595 globals (), locals (), _import_tail )
9696 except ImportError :
9797 pass
Original file line number Diff line number Diff line change 1111
1212import test .test_support , unittest
1313
14- # test codec's full path name (see test/testcodec.py)
15- codecname = 'test.testcodec'
14+ import codecs
15+
16+ # Register a search function which knows about our codec
17+ def codec_search_function (encoding ):
18+ if encoding == 'testcodec' :
19+ from test import testcodec
20+ return tuple (testcodec .getregentry ())
21+ return None
22+
23+ codecs .register (codec_search_function )
24+
25+ # test codec's name (see test/testcodec.py)
26+ codecname = 'testcodec'
1627
1728class CharmapCodecTest (unittest .TestCase ):
1829 def test_constructorx (self ):
Original file line number Diff line number Diff line change @@ -12,6 +12,12 @@ What's New in Python 2.5 alpha 1?
1212Core and builtins
1313-----------------
1414
15+ - Fix the encodings package codec search function to only search
16+ inside its own package. Fixes problem reported in patch #1433198.
17+
18+ Note: Codec packages should implement and register their own
19+ codec search function. PEP 100 has the details.
20+
1521- PEP 353: Using ssize_t as the index type.
1622
1723- Patch #1400181, fix unicode string formatting to not use the locale.
You can’t perform that action at this time.
0 commit comments