[pypy-dev] Compiling pypy with python2.5

Armin Rigo arigo at tunes.org
Sat Mar 24 11:38:05 CET 2007


Hi Amaury,

On Fri, Mar 23, 2007 at 10:57:43PM +0100, Amaury Forgeot d'Arc wrote:
> the struct module is built-in in CPython2.4; so the hack does work.

Ah, I see: the struct module is pure Python in 2.5, so my theory doesn't
hold.  (Btw by 'built-in' I meant 'not a C extension module in a
separate DLL': for the import "semantics" of CPython, built-in modules
take precedence over any other module from any kind of external file,
whereas C extensions can be hidden by other modules earlier on
sys.path.)

But that's not the problem here.  As you noted the difference seems to
be whether the struct module was already imported before or not.  I now
think that the proper hack is to make the 'import struct' local instead
of global, so that geninterp won't try to freeze it in.  The current
situation is very strange, btw, because our struct module is not
geninterp'ed, but the array module is - and it includes a geninterp'ed
version of most of the struct module via this global import.

Can you tell me if it solves the problem if the 'from struct import xxx'
is moved into the fromstring() and tostring() methods?


A bientot,

Armin.



More information about the Pypy-dev mailing list