Skip to content
Permalink
Browse files

Merge pull request #786 from kostya/pid

add $$ variable
  • Loading branch information
alex committed Jun 30, 2013
2 parents 68c8afb + 3dd62e0 commit e463a7499b3263191a3494cdf4e2e15c380b94be
Showing with 4 additions and 0 deletions.
  1. +2 −0 tests/modules/test_process.py
  2. +2 −0 topaz/objspace.py
@@ -15,6 +15,8 @@ def test_euid(self, space):
def test_pid(self, space):
w_res = space.execute("return Process.pid")
assert space.int_w(w_res) == os.getpid()
w_res = space.execute("return $$")
assert space.int_w(w_res) == os.getpid()

def test_exit(self, space):
with self.raises(space, "SystemExit"):
@@ -224,6 +224,8 @@ def __init__(self, config):
self.globals.define_virtual("$LOAD_PATH", lambda space: space.w_load_path)
self.globals.define_virtual("$:", lambda space: space.w_load_path)

self.globals.define_virtual("$$", lambda space: space.send(space.getmoduleobject(Process.moduledef), "pid"))

self.w_loaded_features = self.newarray([])
self.globals.define_virtual("$LOADED_FEATURES", lambda space: space.w_loaded_features)
self.globals.define_virtual('$"', lambda space: space.w_loaded_features)

0 comments on commit e463a74

Please sign in to comment.
You can’t perform that action at this time.