[pypy-commit] pypy kill-someobject: kill the ability to not pass arguments to translate
fijal
noreply at buildbot.pypy.org
Wed Oct 10 11:12:58 CEST 2012
Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: kill-someobject
Changeset: r57963:f81dc995c1dc
Date: 2012-10-09 18:23 +0200
http://bitbucket.org/pypy/pypy/changeset/f81dc995c1dc/
Log: kill the ability to not pass arguments to translate
diff --git a/pypy/config/test/test_config.py b/pypy/config/test/test_config.py
--- a/pypy/config/test/test_config.py
+++ b/pypy/config/test/test_config.py
@@ -111,8 +111,8 @@
else:
return 'foo'
- t = Translation(f)
- t.rtype([int])
+ t = Translation(f, [int])
+ t.rtype()
block = t.context.graphs[0].startblock
assert len(block.exits[0].target.operations) == 0
diff --git a/pypy/translator/interactive.py b/pypy/translator/interactive.py
--- a/pypy/translator/interactive.py
+++ b/pypy/translator/interactive.py
@@ -17,11 +17,8 @@
self.entry_point = entry_point
self.context = TranslationContext(config=self.config)
- # hook into driver events
- self.driver_setup = False
-
policy = kwds.pop('policy', None)
- self.update_options(argtypes, kwds)
+ self.update_options(kwds)
self.ensure_setup(argtypes, policy)
# for t.view() to work just after construction
graph = self.context.buildflowgraph(entry_point)
@@ -35,28 +32,17 @@
def ensure_setup(self, argtypes=None, policy=None):
standalone = argtypes is None
- if not self.driver_setup:
- if standalone:
- assert argtypes is None
- else:
- if argtypes is None:
- argtypes = []
- self.driver.setup(self.entry_point, argtypes, policy,
- empty_translator=self.context)
- self.ann_argtypes = argtypes
- self.ann_policy = policy
- self.driver_setup = True
+ if standalone:
+ assert argtypes is None
else:
- # check consistency
- if standalone:
- assert argtypes is None
- assert self.ann_argtypes is None
- elif argtypes is not None and argtypes != self.ann_argtypes:
- raise Exception("inconsistent argtype supplied")
- if policy is not None and policy != self.ann_policy:
- raise Exception("inconsistent annotation polish supplied")
+ if argtypes is None:
+ argtypes = []
+ self.driver.setup(self.entry_point, argtypes, policy,
+ empty_translator=self.context)
+ self.ann_argtypes = argtypes
+ self.ann_policy = policy
- def update_options(self, argtypes, kwds):
+ def update_options(self, kwds):
gc = kwds.pop('gc', None)
if gc:
self.config.translation.gc = gc
@@ -64,11 +50,11 @@
def ensure_opt(self, name, value=None, fallback=None):
if value is not None:
- self.update_options(None, {name: value})
+ self.update_options({name: value})
return value
val = getattr(self.config.translation, name, None)
if fallback is not None and val is None:
- self.update_options(None, {name: fallback})
+ self.update_options({name: fallback})
return fallback
if val is not None:
return val
@@ -97,69 +83,69 @@
# backend independent
- def annotate(self, argtypes=None, **kwds):
- self.update_options(argtypes, kwds)
+ def annotate(self, **kwds):
+ self.update_options(kwds)
return self.driver.annotate()
# type system dependent
- def rtype(self, argtypes=None, **kwds):
- self.update_options(argtypes, kwds)
+ def rtype(self, **kwds):
+ self.update_options(kwds)
ts = self.ensure_type_system()
return getattr(self.driver, 'rtype_' + ts)()
- def backendopt(self, argtypes=None, **kwds):
- self.update_options(argtypes, kwds)
+ def backendopt(self, **kwds):
+ self.update_options(kwds)
ts = self.ensure_type_system('lltype')
return getattr(self.driver, 'backendopt_' + ts)()
# backend depedent
- def source(self, argtypes=None, **kwds):
- self.update_options(argtypes, kwds)
+ def source(self, **kwds):
+ self.update_options(kwds)
backend = self.ensure_backend()
getattr(self.driver, 'source_' + backend)()
- def source_c(self, argtypes=None, **kwds):
- self.update_options(argtypes, kwds)
+ def source_c(self, **kwds):
+ self.update_options(kwds)
self.ensure_backend('c')
self.driver.source_c()
- def source_cl(self, argtypes=None, **kwds):
- self.update_options(argtypes, kwds)
+ def source_cl(self, **kwds):
+ self.update_options(kwds)
self.ensure_backend('cl')
self.driver.source_cl()
- def compile(self, argtypes=None, **kwds):
- self.update_options(argtypes, kwds)
+ def compile(self, **kwds):
+ self.update_options(kwds)
backend = self.ensure_backend()
getattr(self.driver, 'compile_' + backend)()
return self.driver.c_entryp
- def compile_c(self, argtypes=None, **kwds):
- self.update_options(argtypes, kwds)
+ def compile_c(self, **kwds):
+ self.update_options(kwds)
self.ensure_backend('c')
self.driver.compile_c()
return self.driver.c_entryp
- def compile_cli(self, argtypes=None, **kwds):
- self.update_options(argtypes, kwds)
+ def compile_cli(self, **kwds):
+ self.update_options(kwds)
self.ensure_backend('cli')
self.driver.compile_cli()
return self.driver.c_entryp
- def source_cli(self, argtypes=None, **kwds):
- self.update_options(argtypes, kwds)
+ def source_cli(self, **kwds):
+ self.update_options(kwds)
self.ensure_backend('cli')
self.driver.source_cli()
- def compile_jvm(self, argtypes=None, **kwds):
- self.update_options(argtypes, kwds)
+ def compile_jvm(self, **kwds):
+ self.update_options(kwds)
self.ensure_backend('jvm')
self.driver.compile_jvm()
return self.driver.c_entryp
- def source_jvm(self, argtypes=None, **kwds):
- self.update_options(argtypes, kwds)
+ def source_jvm(self, **kwds):
+ self.update_options(kwds)
self.ensure_backend('jvm')
self.driver.source_jvm()
More information about the pypy-commit
mailing list