Mercurial > pymonkey
diff context.c @ 29:608d086d12e3
Added a new PYM_pyObjectToJsval() function that only supports unicode for the moment. Also, whereever we're assuming that Py_UNICODE is UCS-2, we're surrounding such code with #ifndef Py_UNICODE_WIDE.
author | Atul Varma <varmaa@toolness.com> |
---|---|
date | Tue, 30 Jun 2009 21:23:04 -0700 |
parents | 21045074139f |
children | 3b2bdf2823bb |
line wrap: on
line diff
--- a/context.c Mon Jun 29 14:09:01 2009 -0700 +++ b/context.c Tue Jun 30 21:23:04 2009 -0700 @@ -40,9 +40,7 @@ static PyObject * PYM_getProperty(PYM_JSContextObject *self, PyObject *args) { - // TODO: We're making a lot of copies of the string here, which - // can't be very efficient. - +#ifndef Py_UNICODE_WIDE PYM_JSObject *object; Py_UNICODE *string; @@ -68,6 +66,12 @@ } return PYM_jsvalToPyObject(self, val); +#else + PyErr_SetString(PyExc_NotImplementedError, + "This function is not yet implemented for wide " + "unicode builds of Python."); + return NULL; +#endif } static PyObject * @@ -145,10 +149,9 @@ return JS_FALSE; } - // TODO: Convert result to JS value. + JSBool success = PYM_pyObjectToJsval(cx, result, rval); Py_DECREF(result); - - return JS_TRUE; + return success; } static PyObject *