[Python-Dev] regrtest.py mystery

Martin v. Loewis martin@v.loewis.de
Sun, 16 Dec 2001 10:38:34 +0100

>  > Python/codecs.c holds search functions in _PyCodec_SearchPath, among
>  > them encodings.__init__.search_function. It also imports "encodings"
>  > the first time somebody invokes .encode/.decode on some kind of
>  > string, but doesn't hold onto the module.
>   Perhaps it should hold onto the module as well?  That would avoid it
> getting cleaned up before possibly dependent modules.

Re-importing encodings would still do funny things, then: It would
register itself once more, resulting in two search functions being
registered. codecs would hold one of the encodings modules, but not
the other. So if the second search function is ever invoked, you get
the same error.