code
stringlengths
1
1.72M
language
stringclasses
1 value
""" self cloning, automatic path configuration copy this into any subdirectory of pypy from which scripts need to be run, typically all of the test subdirs. The idea is that any such script simply issues import autopath and this will make sure that the parent directory containing "pypy" is in sys.path. If y...
Python
from pypy.rpython.extfunc import genericcallable, register_external from pypy.translator.flex.modules.flex import add_import, Event, flexTrace from pypy.rpython.ootypesystem.bltregistry import BasicExternal, MethodDesc # This demonstrates: # Global variables (getGlobal, setGlobal), necessary for callback functions to...
Python
""" MoinMoin - Python Source Parser """ # Imports import cgi, string, sys, cStringIO import keyword, token, tokenize ############################################################################# ### Python Source Parser (does Hilighting) ###########################################################################...
Python
#/usr/bin/env python """ This simple example has very little to do with the pygame chimp example, except that it will act the same (more or less) and it uses the same resources, only they got converted to mp3s, pngs. """ #Import Modules from pypy.translator.flex.modules.flex import * from pypy.rpython.ootypesystem.bl...
Python
import os def cmd(c): print c if os.system(c): raise RuntimeError def main(): try: cmd('./py2flex.sh') cmd('~/flex/bin/mxmlc -warnings=false output.mxml') cmd('firefox ./output.swf') except: pass if __name__=='__main__': main()
Python
#/usr/bin/env python """ This simple example has very little to do with the pygame chimp example, except that it will act the same (more or less) and it uses the same resources, only they got converted to mp3s, pngs. """ #Import Modules from pypy.translator.flex.modules.flex import * from pypy.rpython.ootypesystem.bl...
Python
from pypy.translator.flex.modules.flex import * from pypy.rpython.ootypesystem.bltregistry import BasicExternal, MethodDesc class Grossini(): def load_image(self, w): i = Image() i.load("grossini.png") w.addChild(i) class Sonido(): def load_sound(self): s = load_sound_resource(...
Python
from pypy.translator.flex.modules.flex import * from pypy.rpython.ootypesystem.bltregistry import BasicExternal, MethodDesc def callback(event): flexTrace("hola") class Clase: def metodo(self): flexTrace("hola") def flash_main( x=1 ): window = castToWindow( x ) b = Bu...
Python
from pypy.translator.flex.modules.flex import * from pypy.rpython.ootypesystem.bltregistry import BasicExternal, MethodDesc class Grossini(): def load_image(self, w): i = Image() i.load("espejo.png") w.addChild(i) def flash_main( x=1 ): w = castToWindow( x ) w.setActualSize(400,400...
Python
from pypy.translator.flex.modules.flex import * from pypy.rpython.ootypesystem.bltregistry import BasicExternal, MethodDesc class Sonido(): def load_sound(self, w): s = Sound() r = newURLRequest("sal.mp3") s.load(r) s.play() def flash_main( x=1 ): w = castToWindow( x ) o =...
Python
from pypy.translator.flex.modules.flex import * class Bar: def __init__(self, arg): self.arg = arg +"(!)" def setValue(self, arg): self.arg = arg def value(self): return self.arg class Foo: def __init__(self, arg): self.arg = Bar(arg + "@") ...
Python
from pypy.translator.flex.modules.flex import * from pypy.rpython.ootypesystem.bltregistry import BasicExternal, MethodDesc def callback(event, mess): flexTrace(mess) def flash_main( x=1 ): window = castToWindow( x ) b = Button() func = partial(callback, "hola") b.addEventListener("click" , func...
Python
from pypy.rpython.extfunc import genericcallable, register_external from pypy.rpython.ootypesystem.bltregistry import BasicExternal, MethodDesc # For each wrapped function, we define an empty function, and then register it with an actionscript function: # This one is for debug output, so we can see our calls working d...
Python
from pypy.translator.flex.modules.flex import * from pypy.rpython.ootypesystem.bltregistry import BasicExternal, MethodDesc def flash_main( x=1 ): i = Image() i.source = load_resource("py_grossini_png") w = castToWindow( x ) w.addChild(i)
Python
from pypy.translator.flex.modules.flex import * from pypy.rpython.ootypesystem.bltregistry import BasicExternal, MethodDesc from pypy.interpreter.main import run_string import py from pypy.objspace.std import Space from pypy.interpreter.pycompiler import CPythonCompiler as CompilerClass def codetest(source, funct...
Python
from pypy.translator.gensupp import NameManager #from pypy.translator.js.optimize import is_optimized_function class JavascriptNameManager(NameManager): def __init__(self, db): NameManager.__init__(self) self.db = db self.reserved = {} #http://javascript.about.com/library/blreserve...
Python
""" Some helpers """ from pypy.translator.flex.modules.dom import document def escape(s): #return s.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;"). \ # replace("'", "\\'").replace(" ", "&nbsp;").replace("\n", "<br/>") return s def create_debug_div(): debug_div = document.createEl...
Python
""" opcode definitions """ from pypy.translator.oosupport.metavm import PushArg, PushAllArgs, StoreResult,\ InstructionList, New, GetField, MicroInstruction, RuntimeNew, PushPrimitive from pypy.translator.oosupport.metavm import _GetFieldDispatcher, _SetFieldDispatcher, \ _CallDispatcher, _MethodDispatch...
Python
""" genjs class definition """ from pypy.translator.cli.node import Node from pypy.translator.cli.cts import CTS import pypy.translator.flex.asmgen as asmgen class Class(Node): def __init__(self, db, classdef): self.db = db self.cts = db.genoo.TypeSystem(db) self.classdef = classdef ...
Python
""" This is example of totally basic server for XMLHttp request built on top of BaseHTTPServer. Construction is like that: you take your own implementation of Handler and subclass it to provide whatever you like. Each request is checked first for apropriate method in handler (with dots replaced as _) and this method...
Python
""" Some support files for mapping urls, mostly bindings for existing cgi stuff """ import cgi import urllib class URL(object): def __init__(self, path, vars): self.path = path self.vars = vars def __eq__(self, other): if isinstance(other, URL): return self.path == other....
Python
""" Various simple support functions """ from pypy.rpython.ootypesystem.bltregistry import described, load_dict_args,\ MethodDesc from pypy.rpython.extfunc import genericcallable def callback(retval=None, args={}): """ Variant of described decorator, which flows an additional argument with return value...
Python
""" genjs constant database module """ from pypy.rpython.ootypesystem import ootype from pypy.translator.flex.opcodes import opcodes from pypy.translator.flex.function import Function from pypy.translator.flex.log import log from pypy.translator.flex._class import Class from pypy.translator.flex.support import Javasc...
Python
""" tester - support module for testing js code inside python Needs to be imported in case one wants tests involving calling BasicExternal methods """ from pypy.rpython.ootypesystem.bltregistry import BasicExternal def __getattr__(self, attr): val = super(BasicExternal, self).__getattribute__(attr) if not c...
Python
import py, os, re, subprocess from pypy.translator.translator import TranslationContext from pypy.translator.backendopt.all import backend_optimizations from pypy.translator.js.js import JS from pypy.translator.js.test.browsertest import jstest from pypy.translator.js import conftest from pypy.translator.js.log import...
Python
from BaseHTTPServer import HTTPServer as BaseHTTPServer, BaseHTTPRequestHandler import py from os import system from cgi import parse_qs from sys import platform from time import sleep import webbrowser from pypy.translator.js.log import log log = log.browsertest class HTTPServer(BaseHTTPServer): allow_reuse_a...
Python
""" TurboGears browser testing utility """ import thread import pkg_resources pkg_resources.require("TurboGears") import cherrypy import os import sys import webbrowser from pypy.translator.js.demo.jsdemo import controllers conf_file = os.path.join(os.path.dirname(controllers.__file__), "..", "dev.cfg") class ru...
Python
import sys from pypy.translator.llvm.log import log from pypy.rpython.lltypesystem import lltype log = log.pyrex PRIMITIVES_TO_C = {lltype.Bool: "char", lltype.Float: "double", lltype.Char: "char", } # 32 bit platform if sys.maxint == 2**31-1: PRIMITIVES...
Python
import os import sys import types import urllib from pypy.objspace.flow.model import FunctionGraph from pypy.rpython.rmodel import inputconst from pypy.rpython.lltypesystem import lltype from pypy.translator.llvm.codewriter import DEFAULT_CCONV from pypy.translator.llvm.buildllvm import llvm_gcc_version from pypy.too...
Python
from pypy.objspace.flow.model import Constant from pypy.rpython.lltypesystem import lltype from pypy.translator.llvm.log import log from pypy.translator.llvm.structnode import getindexhelper log = log.opwriter class OpRepr(object): __slots__ = "db op retref rettype argrefs argtypes".split() def __init__(self...
Python
from pypy.translator.llvm.log import log from pypy.translator.llvm.node import LLVMNode, ConstantLLVMNode from pypy.rpython.lltypesystem import lltype def getindexhelper(name, struct): assert name in list(struct._names) fieldnames = struct._names_without_voids() try: index = fieldnames.index(name)...
Python
from pypy.translator.llvm.node import ConstantLLVMNode from pypy.translator.llvm.log import log from pypy.translator.c.extfunc import EXTERNALS from pypy.rpython.lltypesystem import lltype log = log.extfuncnode from sys import maxint class ExtFuncSig(object): def __init__(self, rettype, args): self.rett...
Python
import os import sys import py from pypy.translator.llvm.log import log from pypy.translator.llvm.pyxwrapper import write_pyx_wrapper from pypy.translator.tool import stdoutcapture from pypy.translator.tool.cbuild import make_c_from_pyxfile import distutils.sysconfig def llvm_is_on_path(): if py.path.local.sys...
Python
from pypy.translator.llvm.log import log log = log.codewriter DEFAULT_TAIL = '' #/tail DEFAULT_CCONV = 'fastcc' #ccc/fastcc DEFAULT_LINKAGE = 'internal ' #/internal (disabled for now because of the JIT) class CodeWriter(object): def __init__(self, file, db, tail=DEFAULT_TAIL, cconv=DEFA...
Python
from pypy.translator.llvm.node import LLVMNode, ConstantLLVMNode from pypy.rpython.lltypesystem import lltype class OpaqueTypeNode(LLVMNode): def __init__(self, db, opaquetype): assert isinstance(opaquetype, lltype.OpaqueType) self.db = db self.opaquetype = opaquetype self.ref = "...
Python
import py from pypy.tool.ansi_print import ansi_log log = py.log.Producer('llvm') py.log.setconsumer('llvm', ansi_log)
Python
def _noresult(returntype): r = returntype.strip() if r == 'void': return 'void' elif r == 'bool': return 'bool false' elif r in 'float double'.split(): return r + ' 0.0' elif r in 'ubyte sbyte ushort short uint int ulong long'.split(): return r + ' 0' return r + ...
Python
from pypy.objspace.flow.model import Block, Constant, Link from pypy.objspace.flow.model import mkentrymap, c_last_exception from pypy.rpython.lltypesystem import lltype from pypy.translator.llvm.node import LLVMNode, ConstantLLVMNode from pypy.translator.llvm.opwriter import OpWriter from pypy.translator.llvm.log impo...
Python
import sys from pypy.rpython.lltypesystem.rstr import STR from pypy.translator.c import gc from pypy.translator.llvm.log import log log = log.gc from pypy.translator.llvm.buildllvm import postfix def have_boehm(): import distutils.sysconfig from os.path import exists libdir = distutils.sysconfig.EXEC_PRE...
Python
from pypy.rpython.lltypesystem import lltype from pypy.translator.llvm.log import log from pypy.translator.llvm.node import LLVMNode, ConstantLLVMNode log = log.structnode class ArrayTypeNode(LLVMNode): __slots__ = "db array arraytype ref constructor_ref constructor_decl".split() def __init__(self, db, array)...
Python
from pypy.rpython.lltypesystem import lltype class LLVMNode(object): __slots__ = "".split() nodename_count = {} def make_name(self, name): " helper for creating names" if name in self.nodename_count: postfix = '_%d' % self.nodename_count[name] self.nodename_count[n...
Python
extdeclarations = """ %last_exception_type = internal global %RPYTHON_EXCEPTION_VTABLE* null %last_exception_value = internal global %RPYTHON_EXCEPTION* null declare ccc uint %strlen(sbyte*) declare ccc void %llvm.memsetPOSTFIX(sbyte*, ubyte, UWORD, UWORD) declare ccc void %llvm.memcpyPOSTFIX(sbyte*, sbyte*, UWORD, ...
Python
exctransform_code = ''' ccc %(returntype)s%%__entrypoint__%(entrypointname)s { store %%RPYTHON_EXCEPTION_VTABLE* null, %%RPYTHON_EXCEPTION_VTABLE** %%last_exception_type %%result = call %(cconv)s %(returntype)s%%%(entrypointname)s %%tmp = load %%RPYTHON_EXCEPTION_VTABLE** %%last_exception_type %%exc...
Python
import time from pypy.tool.isolate import Isolate from pypy.translator.llvm import buildllvm from pypy.translator.llvm.database import Database from pypy.rpython.rmodel import inputconst from pypy.rpython.typesystem import getfunctionptr from pypy.rpython.lltypesystem import lltype from pypy.tool.udir import udir f...
Python
import sys from pypy.translator.llvm.log import log from pypy.translator.llvm.funcnode import FuncNode, FuncTypeNode from pypy.translator.llvm.extfuncnode import ExternalFuncNode, SimplerExternalFuncNode from pypy.translator.llvm.structnode import StructNode, StructVarsizeNode, \ StructTypeNode, StructVarsizeTy...
Python
from __future__ import division #function snippets def simple1(): return 1 def simple2(): return False def simple3(i): c = "Hello, Stars!" return c[i] def simple4(): return 3 + simple1() def simple5(b): if b: x = 12 else: x = 13 return x def simple6(): simple4()...
Python
import py from pypy.tool import isolate from pypy.translator.llvm.buildllvm import llvm_is_on_path, llvm_version, gcc_version from pypy.translator.llvm.genllvm import GenLLVM optimize_tests = False MINIMUM_LLVM_VERSION = 1.9 ext_modules = [] # test options run_isolated_only = True do_not_isolate = False from pypy i...
Python
#!/usr/bin/env python """This script computes the relative performance between python implementations on a set of microbenchmarks. The script usally is started with "./microbench.py python ./pypy" where pypy is a symlink to you pypy exectable.""" import os, time, sys microbenches = [] for fname in os.listdir('.'): ...
Python
#!/usr/bin/env python """This script computes the relative performance between python implementations on a set of microbenchmarks. The script usally is started with "./microbench.py python ./pypy" where pypy is a symlink to you pypy exectable.""" import os, time, sys microbenches = [] for fname in os.listdir('.'): ...
Python
from pybench import Test class SimpleListManipulation(Test): version = 0.2 operations = 5* (6 + 6 + 6) rounds = 60000 def test(self): l = [] for i in xrange(self.rounds): l.append(2) l.append(3) l.append(4) l.append(2) l.a...
Python
from pybench import Test class CreateInstances(Test): version = 0.2 operations = 3 + 7 + 4 rounds = 60000 def test(self): class c: pass class d: def __init__(self,a,b,c): self.a = a self.b = b self.c = c ...
Python
try: unicode except NameError: raise ImportError from pybench import Test from string import join class ConcatUnicode(Test): version = 0.1 operations = 10 * 5 rounds = 60000 def test(self): # Make sure the strings are *not* interned s = unicode(join(map(str,range(100)))) ...
Python
#!/usr/local/bin/python -O """ A Python Benchmark Suite """ __copyright__="""\ Copyright (c), 1997-2001, Marc-Andre Lemburg (mal@lemburg.com) All Rights Reserved. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee or royalty...
Python
from pybench import Test class CompareIntegers(Test): version = 0.1 operations = 30 * 5 rounds = 120000 def test(self): for i in xrange(self.rounds): 2 < 3 2 > 3 2 == 3 2 > 3 2 < 3 2 < 3 2 > 3 ...
Python
from pybench import Test class PythonFunctionCalls(Test): version = 0.3 operations = 5*(1+4+4+2) rounds = 60000 def test(self): global f,f1,g,h # define functions def f(): pass def f1(x): pass def g(a,b,c): return a,b,c ...
Python
#!python # Setup file for pybench # # This file has to import all tests to be run; it is executed as # Python source file, so you can do all kinds of manipulations here # rather than having to edit the tests themselves. # # Defaults Number_of_rounds = 10 Warp_factor = 20 # Import tests from Arithmetic import * from ...
Python
#!/usr/local/bin/python -O """ A Python Benchmark Suite """ __copyright__="""\ Copyright (c), 1997-2001, Marc-Andre Lemburg (mal@lemburg.com) All Rights Reserved. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee or royalty...
Python
from pybench import Test class SimpleIntegerArithmetic(Test): version = 0.3 operations = 5 * (3 + 5 + 5 + 3 + 3 + 3) rounds = 120000 def test(self): for i in xrange(self.rounds): a = 2 b = 3 c = 3 c = a + b c = b + c c...
Python
#!python # Setup file for pybench # # This file has to import all tests to be run; it is executed as # Python source file, so you can do all kinds of manipulations here # rather than having to edit the tests themselves. # # Defaults Number_of_rounds = 10 Warp_factor = 20 # Import tests from Arithmetic import * from ...
Python
from pybench import Test # First imports: import os import package.submodule class SecondImport(Test): version = 0.1 operations = 5 * 5 rounds = 20000 def test(self): for i in xrange(self.rounds): import os import os import os import os ...
Python
""" self cloning, automatic path configuration copy this into any subdirectory of pypy from which scripts need to be run, typically all of the test subdirs. The idea is that any such script simply issues import autopath and this will make sure that the parent directory containing "pypy" is in sys.path. If y...
Python
from pybench import Test class TupleSlicing(Test): version = 0.31 operations = 3 * 25 * 10 * 7 rounds = 400 def test(self): r = range(25) for i in xrange(self.rounds): t = tuple(range(100)) for j in r: m = t[50:] m = t[:25] ...
Python
from pybench import Test class DictCreation(Test): version = 0.3 operations = 5*(5 + 5) rounds = 60000 def test(self): for i in xrange(self.rounds): d1 = {} d2 = {} d3 = {} d4 = {} d5 = {} d1 = {1:2,3:4,5:6} ...
Python
from pybench import Test class IfThenElse(Test): version = 0.31 operations = 30*3 # hard to say... rounds = 150000 def test(self): a,b,c = 1,2,3 for i in xrange(self.rounds): if a == 1: if b == 2: if c != 3: c =...
Python
from pybench import Test class TryRaiseExcept(Test): version = 0.1 operations = 2 + 3 rounds = 60000 def test(self): error = ValueError for i in xrange(self.rounds): try: raise error except: pass try: ...
Python
from pybench import Test class SpecialClassAttribute(Test): version = 0.3 operations = 5*(12 + 12) rounds = 100000 def test(self): class c: pass for i in xrange(self.rounds): c.__a = 2 c.__b = 3 c.__c = 4 c.__a = 2 ...
Python
from pypy.rpython.lltypesystem import lltype, llmemory from pypy.rpython.lltypesystem.lloperation import LL_OPERATIONS from pypy.rlib import rarithmetic from pypy.rpython import rclass, rmodel from pypy.translator.backendopt import support from pypy.objspace.flow import model from pypy.translator import unsimplify, sim...
Python
from pypy.rpython.lltypesystem import lltype, llmemory, lloperation from pypy.tool.sourcetools import func_with_new_name from pypy.rlib import rarithmetic from pypy.rpython import extfunctable from pypy.translator.stackless import frame from pypy.translator.stackless.frame import STATE_HEADER, SAVED_REFERENCE, STORAGE_...
Python
#
Python
from pypy.rpython.lltypesystem import lltype, llmemory from pypy.rpython import extfunctable from pypy.rpython.typesystem import getfunctionptr from pypy.rpython.annlowlevel import annotate_lowlevel_helper from pypy.objspace.flow.model import FunctionGraph from pypy.tool.sourcetools import compile2 from pypy.annotation...
Python
#ra
Python
from pypy.objspace.flow.model import * def copyvar(annotator, v): """Make a copy of the Variable v, preserving annotations and concretetype.""" assert isinstance(v, Variable) newvar = Variable(v) if annotator is not None and v in annotator.bindings: annotator.transfer_binding(newvar, v) if ...
Python
from pypy.translator.test import rpystone from pypy.translator.c.symboltable import getsymboltable def make_target_definition(LOOPS): def entry_point(loops): g = rpystone.g g.IntGlob = 0 g.BoolGlob = 0 g.Char1Glob = '\0' g.Char2Glob = '\0' for i in range(51): ...
Python
import sys import os RTYPERORDER = os.getenv('RTYPERORDER').split(',') if len(RTYPERORDER) == 2: module_list = RTYPERORDER[1] else: module_list = 'module-list' lst = open(module_list, 'r') try: print "reading module-list: %s" % module_list prefixes = lst.readlines() finally: lst.close() prefixes = [li...
Python
import os, sys #from pypy.translator.goal import richards modfilename = os.path.join(os.path.dirname(__file__), 'richards.py') # Number of times richards is imported in parallel. # Can be changed on the command line, e.g. # # translate.py targetvarsized.py 20 # DEFAULT_CODE_SIZE_FACTOR = 10 take_options = True...
Python
# functions to query information out of the translator and annotator from the debug prompt of translate import types import re import pypy.annotation.model as annmodel import pypy.objspace.flow.model as flowmodel # query used for sanity checks by translate def short_binding(annotator, var): try: binding ...
Python
def getitem(list, index): return list[index] def entry_point(i): return getitem([i, 2, 3, 4], 2) + getitem(None, i) def target(*args): return entry_point, [int] def get_llinterp_args(): return [1] # _____ Run translated _____ def run(c_entry_point): c_entry_point(0)
Python
print '--- beginning of PyPy run of app_example.py ---' print 6*7 print "OK, we managed to print a good number, now let's try 'import code'" print "(this will last a while, because compiling happens at app-level)" import code print "fine, we managed to import 'code', now let's run code.interact()" code.interact()
Python
# for test_app_main import sys print 'mymodule running' print 'Name:', __name__ print 'File:', __file__ print 'Argv:', sys.argv somevalue = "foobar"
Python
""" self cloning, automatic path configuration copy this into any subdirectory of pypy from which scripts need to be run, typically all of the test subdirs. The idea is that any such script simply issues import autopath and this will make sure that the parent directory containing "pypy" is in sys.path. If y...
Python
#empty
Python
# benchmarks on a unix machine. # to be executed in the goal folder, # where a couple of pypy-* files is expected. import os, sys, time, pickle PYSTONE_CMD = 'from test import pystone;pystone.main(%s)' PYSTONE_PATTERN = 'This machine benchmarks at' PYSTONE_ASCENDING_GOOD = True RICHARDS_CMD = 'from richards import *...
Python
import os, sys from pypy.translator.goal import gcbench def entry_point(argv): if len(argv) > 1: n = int(argv[1]) else: n = 1 while n > 0: gcbench.main() n -= 1 return 0 # _____ Define and setup target ___ def target(*args): return entry_point, None """ Why is thi...
Python
from pypy.rlib.jit import hint, we_are_jitted def jitted(): print "jitted" def compute(x, y): if we_are_jitted(): jitted() hint(x, concrete=True) r = x + y return r # __________ Entry point __________ def entry_point(argv): if len(argv) <3: return -2 r = compute(int(arg...
Python
#! /usr/bin/env python """ Command-line options for translate: See below """ import sys, os, new import autopath from pypy.config.config import to_optparse, OptionDescription, BoolOption, \ ArbitraryOption, StrOption, IntOption, Config, \ ChoiceOptio...
Python
""" A simple standalone target. The target below specifies None as the argument types list. This is a case treated specially in driver.py . If the list of input types is empty, it is meant to be a list of strings, actually implementing argv of the executable. """ import os, sys def debug(msg): os.write(2, "debu...
Python
""" A simple standalone target. The target below specifies None as the argument types list. This is a case treated specially in driver.py . If the list of input types is empty, it is meant to be a list of strings, actually implementing argv of the executable. """ import os, sys # __________ Entry point __________ ...
Python
""" A simple standalone target for the prolog interpreter. """ import sys from pypy.lang.prolog.interpreter.translatedmain import repl, execute # __________ Entry point __________ from pypy.lang.prolog.interpreter.engine import Engine from pypy.lang.prolog.interpreter import engine, term e = Engine() engine.DEBUG ...
Python
def buildcache(space): from pypy.interpreter.typedef import interptypes space.builtin.getdict() print "*builtin*" w_dic = space.builtin.w_dict #print space.unwrap(space.call_method(w_dic,"keys")) space.sys.getdict() print "*sys*" w_dic = space.sys.w_dict #print space.unwr...
Python
# benchmarks on a windows machine. # to be executed in the goal folder, # where a couple of .exe files is expected. USE_HIGH_PRIORITY = True # usage with high priority: # the program will try to import subprocess. # you can have this with python older than 2.4: copy # subprocess into lib and change line 392 to use win...
Python
import os, sys from pypy.objspace.std.objspace import StdObjSpace # XXX from pypy.annotation.model import * # since we are execfile()'ed this would pull some # weird objects into the globals, which we would try to pickle. from pypy.interpreter import gateway from pypy.interpreter.error import OperationError from pypy....
Python
import py import os, sys from pypy.objspace.std.objspace import StdObjSpace from pypy.interpreter import gateway from pypy.interpreter.error import OperationError from pypy.translator.goal.ann_override import PyPyAnnotatorPolicy from pypy.config.config import Config, to_optparse, make_dict, SUPPRESS_USAGE from pypy.t...
Python
#! /usr/bin/env python """ Command-line options for translate: See below """ import sys, os, new import autopath from pypy.config.config import to_optparse, OptionDescription, BoolOption, \ ArbitraryOption, StrOption, IntOption, Config, \ ChoiceOptio...
Python
#! /usr/bin/env python import os homedir = os.getenv('HOME') os.environ['PATH'] += ':/usr/local/bin:/usr/local/llvm/cfrontend/ppc/llvm-gcc/bin:'+homedir+'/bin' import autopath import py import time, os, sys, stat from pypy.translator.llvm.buildllvm import Builder os.umask(022) # allow everyone to read/execute t...
Python
#! /usr/bin/env python # App-level version of py.py. # See test/test_app_main. """ options: -i inspect interactively after running script -O dummy optimization flag for compatibility with C Python -c CMD program passed in as CMD (terminates option list) -S do not 'import site...
Python
import os, sys def restart_process(): import sys os.execv(sys.executable, [sys.executable] + sys.argv) def restartable_point_fork(auto=None, extra_msg=None): while True: while True: if extra_msg: print extra_msg print '---> Checkpoint: cont / restart-it-all ...
Python
import thread, time class MonitorList(list): def append(self, obj): list.append(self, obj) print "running grown to %r\n" % self, def remove(self, obj): list.remove(self, obj) print "running shrunk to %r\n" % self, running = MonitorList() def f(name, count, modulus): runnin...
Python
""" A simple standalone target. The target below specifies None as the argument types list. This is a case treated specially in driver.py . If the list of input types is empty, it is meant to be a list of strings, actually implementing argv of the executable. """ import os, sys def debug(msg): os.write(2, "debu...
Python
# based on a Java version: # Based on original version written in BCPL by Dr Martin Richards # in 1981 at Cambridge University Computer Laboratory, England # and a C++ version derived from a Smalltalk version written by # L Peter Deutsch. # Java version: Copyright (C) 1995 Sun Microsystems, Inc. # Translation fr...
Python
# overrides for annotation specific to PyPy codebase from pypy.annotation.policy import AnnotatorPolicy, Sig # for some reason, model must be imported first, # or we create a cycle. from pypy.objspace.flow.model import Constant from pypy.annotation import model as annmodel from pypy.annotation.bookkeeper import getbook...
Python