[pypy-dev] Re: [pypy-svn] r20364 - in pypy/branch/somepbc-refactoring/pypy/translator/c: . test
Michael Hudson
mwh at python.net
Tue Nov 29 10:36:31 CET 2005
Samuele Pedroni <pedronis at strakt.com> writes:
>> if isinstance(spec, tuple):
>> spec = spec[0] # use the first type only for the tests
>> argstypelist.append(spec)
>> - a = t.annotate(argstypelist)
>> + a = t.buildannotator()
>> + a.build_types(func, argstypelist)
>> a.simplify()
>> - return skip_missing_compiler(t.ccompile)
>> + from pypy.translator.c import genc
>> + builder = genc.CExtModuleBuilder(t, func)
>> + builder.generate_source()
>> + skip_missing_compiler(builder.compile)
>> + builder.import_module()
>> + return builder.get_entry_point()
>> def test_set_attr(self):
>> set_attr = self.getcompiled(snippet.set_attr)
>>
>
> I missed this subtle point, indeed before going on writing more code
> like this, we need to think where and how much of
> translator.Translator to keep working and where instead to switch
> using TranslationContext
Definitely. I wrote that stuff largely to see how hard it would be
and the answer is "not very, but it's a bit long winded". It's
definitely too much to write in each test file. OTOH, it's hard to
share this code between test files, because e.g. test_typed wants to
do almost exactly the same but do rtyping in the middle. I'm a bit at
a loss as to a clean design
callable = self.compile(f, "annotate")
callable = self.compile(f, "annotate", "rtype")
callable = self.compile(f, "annotate", "rtype", "backendopt")
?
Cheers,
mwh
--
I wouldn't trust the Anglo-Saxons for much anything else. Given
they way English is spelled, who could trust them on _anything_ that
had to do with writing things down, anyway?
-- Erik Naggum, comp.lang.lisp
More information about the Pypy-dev
mailing list