Re: [pypy-svn] r12876 - pypy/dist/lib-python/modified-2.3.4/encodings

Hi Ale, On Mon, May 30, 2005 at 12:38:23AM +0200, ale@codespeak.net wrote:
Sorry, I missed an older checkin (r11820) where you did something similar. There must be another way than modifying the encodings package (as you hint in the check-in message). Some time ago, for precisely this reason, we introduced a way to define functions that aren't bound in the normal Python way, but behave like CPython's builtin functions: def escape_encode( obj,errors='strict'): """None """ s = repr(obj) v = s[1:-1] return v,len(v) escape_encode = types.BuiltinFunctionType(escape_encode) I'm still unsure if it's a good solution to use it all over the place in _codecs.py because it's PyPy-specific. Another solution is to keep _codecs.py clean of this, but put the whole module in pypy/module/_codecs/app__codecs.py instead of pypy/lib/. This way, all functions exported by the _codecs module become "builtin functions" automatically. (It also allows you to hide parts you don't want to export, like the codec_search_path and codec_search_cache registry.) The advantage is that app__codecs.py by itself is still usable by non-PyPy projects. A bientot, Armin
participants (1)
-
Armin Rigo