[pypy-dev] make _ssl module compile

Armin Rigo arigo at tunes.org
Tue Aug 1 13:06:59 CEST 2006


Hi Lawrence,

On Sat, Jul 29, 2006 at 03:58:45PM +0200, Lawrence Oluyede wrote:
> [translation:ERROR]  AttributeError: 'CallEntry' object has no
> attribute 'get_repr'

This means that you are passing 'ctypes function' objects around, in
variables.  The only thing you can do with ctypes functions is call them
directly.  For now you have to find a workaround, e.g. pass stub RPython
functions around.  E.g. instead of:

    f1 = mylib.f1
    f2 = mylib.f2

    def invoke(f):
        return f(17)     # 'f' holds a variable ctypes function object

    ... 
       invoke(f1)
    ...
       invoke(f2)

Do:

    f1 = mylib.f1
    f2 = mylib.f2

    def f1stub(x): return f1(x)
    def f2stub(x): return f2(x)

    def invoke(f):
        return f(17)     # 'f' holds a regular RPython function

    ... 
       invoke(f1stub)
    ...
       invoke(f2stub)

(Note: this and a number of other ext-compiler or rctypes limitations
could be removed with a bit of work; don't hesitate to tell us if a
particular workaround seems really awkard in your cases.  I'd love this
kind of input, to know where to put efforts for more support.)


A bientot,

Armin



More information about the Pypy-dev mailing list