[pypy-issue] [issue1233] str() types can't be used with ctypes's py_object()

Armin Rigo tracker at bugs.pypy.org
Mon Sep 3 12:07:40 CEST 2012

Armin Rigo <armin.rigo at gmail.com> added the comment:

For example, the function add_timer() from timer.py can be rewritten much more
simply as follows (untested code):

def add_timer(interval, callback, param=None):
    if interval < 0:
        raise ValueError("interval must not be smaller than 0")

    def llcallback(x, y, null_ignored):
        return callback(x, y, param)
    timerid = dll.SDL_AddTimer(interval, llcallback, 0)
    if timerid == 0 or not bool(timerid):
        raise SDLError()
    return timerid

PyPy bug tracker <tracker at bugs.pypy.org>

More information about the pypy-issue mailing list