[pypy-dev] Re: [pypy-svn] r12037 -
pypy/dist/lib-python/modified-2.3.4/test
Armin Rigo
arigo at tunes.org
Sun May 8 08:02:42 CEST 2005
Hi Anders,
On Sat, May 07, 2005 at 12:34:12AM +0200, ale at codespeak.net wrote:
> Modified: pypy/dist/lib-python/modified-2.3.4/test/test_codeccallbacks.py
> ==============================================================================
> +import sys, htmlentitydefs, unicodedata
> +sys.path.insert(0,r'd:\projects\pypy_co')
> +sys.path.insert(0,r'd:\projects\pypy_co\pypy\lib')
> +sys.path.insert(0,r'd:\projects\pypy_co\lib-python\modified-2.3.4')
> +sys.path.insert(0,r'd:\projects\pypy_co\lib-python\2.3.4')
> +from pypy.lib import _codecs
> +sys.modules['_codecs'] = _codecs
> +from pypy.lib import encodings
> +sys.modules['encodings'] = encodings
> +from pypy.lib import codecs
> +sys.modules['codecs'] = codecs
> +reload(encodings)
> +reload(codecs)
> +assert codecs == encodings.codecs
Hard-coded paths? Hum. Sorry for the confusion: although PyPy's own
sys.path includes this 'pypy/lib' directory, importing '_codecs' doesn't
find the file pypy/lib/_codecs.py because it is special-cased in
pypy/module/sys2/state.py. Holger just removed it from there, so now
you should be able to just import _codecs normally.
In general, importing the pypy package at app-level is likely to make
things crash. A few days ago I moved a similar piece of code out of the
way because it confused the translation process. Mea culpa; I should
have signalled the problem and proposed a solution. (On the other hand,
feel free to ask on pypy-dev when you get such issues :-)
A bientot,
Armin.
More information about the pypy-dev
mailing list