GitLab will continue to be upgraded from 11.4.5-ce.0 on November 25th 2019 at 4.00pm (AEDT) to 5.00pm (AEDT) due to Critical Security Patch Availability. During the update, GitLab and Mattermost services will not be available.

Commit 9ce88169 authored by Stefan Marr's avatar Stefan Marr

Use a class field to store current Universe

Globals are not supported by RPython
Signed-off-by: 's avatarStefan Marr <git@stefan-marr.de>
parent 6b6aed8e
......@@ -5,7 +5,6 @@ from som.interpreter.interpreter import Interpreter
from som.interpreter.bytecodes import Bytecodes
from som.interpreter.frame import Frame
from som.vm.symbol_table import SymbolTable
from som.vmobjects.abstract_object import AbstractObject
from som.vmobjects.object import Object
from som.vmobjects.clazz import Class
from som.vmobjects.array import Array
......@@ -33,6 +32,9 @@ class GlobalVersion(object):
pass
class Universe(object):
CURRENT = None
_immutable_fields_ = [
"nilObject",
"trueObject",
......@@ -78,6 +80,7 @@ class Universe(object):
self.start_time = time.time() # a float of the time in seconds
self.random = Random(abs(int(time.clock() * time.time())))
CURRENT = self
def exit(self, error_code):
if self._avoid_exit:
......@@ -540,17 +543,13 @@ def std_print(msg):
def std_println(msg = ""):
os.write(1, msg + "\n")
# Global Universe instance
u = None
def main(args):
global u
u = Universe()
u.interpret(args[1:])
u.exit(0)
def get_current():
return u
return Universe.CURRENT
if __name__ == '__main__':
import sys
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment