示例#1
0
 def startup(self, space):
     # Hold a permanent handle to the globals object.
     self.h_globals = support.emjs_globals()
     _check_error(space, self.h_globals)
     # And a permanent object while we're at it.
     self.w_globals.handle = self.h_globals
     # Hold a permanent handle to the Array type constructor.
     self.h_array = support.emjs_prop_get_str(self.h_globals, "Array")
     _check_error(space, self.h_array)
     # Create a custom Error type for throwing errors from python callbacks.
     self.h_pyerror = support.emjs_eval("""
       (function() {
         function PyError(message) {
           this.name = PyError;
           this.message = message || 'Python Error';
         }
         PyError.prototype = new Error();
         PyError.prototype.constructor = PyError;
         return PyError;
       })()
     """)
     _check_error(space, self.h_pyerror)
示例#2
0
文件: interp_js.py 项目: bukzor/pypy
 def startup(self, space):
     # Hold a permanent handle to the globals object.
     self.h_globals = support.emjs_globals()
     _check_error(space, self.h_globals)
     # And a permanent object while we're at it.
     self.w_globals.handle = self.h_globals
     # Hold a permanent handle to the Array type constructor.
     self.h_array = support.emjs_prop_get_str(self.h_globals, "Array")
     _check_error(space, self.h_array)
     # Create a custom Error type for throwing errors from python callbacks.
     self.h_pyerror = support.emjs_eval("""
       (function() {
         function PyError(message) {
           this.name = PyError;
           this.message = message || 'Python Error';
         }
         PyError.prototype = new Error();
         PyError.prototype.constructor = PyError;
         return PyError;
       })()
     """)
     _check_error(space, self.h_pyerror)
示例#3
0
def globals(space):
    """Get a reference to the global scope 'this' object."""
    h = support.emjs_globals()
    return _wrap_handle(space, h)
示例#4
0
文件: interp_js.py 项目: bukzor/pypy
def globals(space):
    """Get a reference to the global scope 'this' object."""
    h = support.emjs_globals()
    return _wrap_handle(space, h)