Mercurial > pymonkey
comparison runtime.c @ 87:345d4c0e3dd3
Thread safety exceptions are now properly raised by all relevant pymonkey functions.
author | Atul Varma <varmaa@toolness.com> |
---|---|
date | Sun, 09 Aug 2009 16:17:25 -0700 |
parents | 2b5696b91b01 |
children |
comparison
equal
deleted
inserted
replaced
86:16a3e99e9b77 | 87:345d4c0e3dd3 |
---|---|
44 { | 44 { |
45 PYM_JSRuntimeObject *self; | 45 PYM_JSRuntimeObject *self; |
46 | 46 |
47 self = (PYM_JSRuntimeObject *) type->tp_alloc(type, 0); | 47 self = (PYM_JSRuntimeObject *) type->tp_alloc(type, 0); |
48 if (self != NULL) { | 48 if (self != NULL) { |
49 self->thread = PyThread_get_thread_ident(); | |
49 self->rt = NULL; | 50 self->rt = NULL; |
50 self->cx = NULL; | 51 self->cx = NULL; |
51 self->objects.ops = NULL; | 52 self->objects.ops = NULL; |
52 | 53 |
53 if (!JS_DHashTableInit(&self->objects, | 54 if (!JS_DHashTableInit(&self->objects, |
104 } | 105 } |
105 | 106 |
106 static PyObject * | 107 static PyObject * |
107 PYM_newContext(PYM_JSRuntimeObject *self, PyObject *args) | 108 PYM_newContext(PYM_JSRuntimeObject *self, PyObject *args) |
108 { | 109 { |
110 PYM_SANITY_CHECK(self); | |
109 JSContext *cx = JS_NewContext(self->rt, 8192); | 111 JSContext *cx = JS_NewContext(self->rt, 8192); |
110 if (cx == NULL) { | 112 if (cx == NULL) { |
111 PyErr_SetString(PYM_error, "JS_NewContext() failed"); | 113 PyErr_SetString(PYM_error, "JS_NewContext() failed"); |
112 return NULL; | 114 return NULL; |
113 } | 115 } |