WARNING! Access to this system is limited to authorised users only.
Unauthorised users may be subject to prosecution.
Unauthorised access to this system is a criminal offence under Australian law (Federal Crimes Act 1914 Part VIA)
It is a criminal offence to:
(1) Obtain access to data without authority. -Penalty 2 years imprisonment.
(2) Damage, delete, alter or insert data without authority. -Penalty 10 years imprisonment.
User activity is monitored and recorded. Anyone using this system expressly consents to such monitoring and recording.

To protect your data, the CISO officer has suggested users to enable 2FA as soon as possible.
Currently 2.2% of users enabled 2FA.

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

Use a class field to store current Universe



Globals are not supported by RPython
Signed-off-by: default 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