Hi,

2011/3/12 Greg Price <g...@quora.com>:
> +                 """
> +                    PyObject *t = PyTuple_New(1);
> +                    PyObject *i = PyInt_FromLong(42);
> +                    PyTuple_SetItem(t, 0, i);
> +                    i = PyTuple_GetItem(t, 0);
> +                    PyTuple_GetItem(t, 0);
> +                    Py_DECREF(t);
> +                    return PyInt_FromLong(PyInt_AsLong(i));
> +                 """),

This example is wrong: you don't own the reference to int(42);
after the tuple is released, PyInt_AsLong(i) is illegal.

-- 
Amaury Forgeot d'Arc
_______________________________________________
pypy-dev@codespeak.net
http://codespeak.net/mailman/listinfo/pypy-dev

Reply via email to