Permalink
Browse files

0.2 release

  • Loading branch information...
1 parent 99d3b6c commit 4317ca457fe1c5bc631331a78579ad7630a76ee1 @unbit committed Oct 10, 2011
Showing with 13 additions and 6 deletions.
  1. +12 −5 pydrone.c
  2. +1 −1 setup.py
View
17 pydrone.c
@@ -60,8 +60,14 @@ static JSClass global_class = {
// map js exception to python's one
void js_raise_exc(JSContext *context, const char *message, JSErrorReport *report) {
- PyErr_Format(PyExc_ValueError, "%s:%u:%s", report->filename,
- (unsigned int) report->lineno, message);
+ if (!report->filename) {
+ PyErr_Format(PyExc_ValueError, "%s", message);
+ }
+ else {
+
+ PyErr_Format(PyExc_ValueError, "%s:%u:%s", report->filename,
+ (unsigned int) report->lineno, message);
+ }
int *error = JS_GetContextPrivate(context);
@@ -278,15 +284,16 @@ static PyObject *pydrone_js(PyObject *self, PyObject *args) {
JS_SetProperty(context, global, "data", &js_data);
// evaluate the script
- JS_EvaluateScript(context, global, script, script_len, "pydrone", 1, &rval);
+ JSBool jret = JS_EvaluateScript(context, global, script, script_len, "pydrone", 1, &rval);
- // check for exception
- if (error == 1) {
+ // check for exceptions
+ if (jret == JS_FALSE || error == 1) {
JS_DestroyContext(context);
JS_DestroyRuntime(runtime);
JS_ShutDown();
return NULL;
}
+
PyObject *ret = js_to_py(context, rval);
View
2 setup.py
@@ -7,6 +7,6 @@
setup (name = 'pydrone',
author = 'Unbit',
- version = '0.1',
+ version = '0.2',
description = 'pydrone',
ext_modules = [module])

0 comments on commit 4317ca4

Please sign in to comment.