Guido van Rossum schrieb:
> Are you interested in doing this at the Google sprint next week?
Sure; I hadn't any special plans so far.
> What do you think?
Sounds good. There are two problems I see:
- how to benchmark?
- there are subtle details in the API that require changes
to extension code. In particular, PyInt_AsLong currently
cannot fail, but can fail with a range error after the
unification.
However, to evaluate the performance, it is possible to work
around that.
For this specific problem, I would propose to introduce
another API, say
int PyLong_ToLong(PyObject* val, long* result);
which will return true(1) for success, and set an exception
in case of a failure. Then, we get
long PyLong_AsLong(PyObj *val)
{
long result;
if(!PyLong_ToLong(val, &result))return -1;
return result;
}
and perhaps
long PyInt_AsLong(PyObj* val)
{
long result;
if(!PyLong_ToLong(val, &result))
Py_FatalError("old-style integer conversion failed");
return result;
}
Regards,
Martin
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe:
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com