On Thu, Dec 9, 2010 at 10:33 AM, Armin Rigo <[email protected]> wrote: > Hi, > > Sorry for the series of mails. I just wanted to add that after > looking more at the code, it's fine if you implement major() and > minor() the same way as the other posix functions (see e.g. r79941 > adding os.fchdir()), calling the major() and minor() "functions" in C. > If you add tests in the same places I did in r79941, then it should > work even if the functions are actually macros. One place where it > would not work is in translated code running on the llinterp; the > other place might be the JIT trying to get the address of the > "function". (If that's the case, we should fix that a bit more > generally.) > > > A bientôt, > > Armin.
I attempted to add os.major and os.minor using fchdir as an example, but... I have to admit: I really don't know what to make of this error. Comments? [translation:ERROR] Error: [translation:ERROR] Traceback (most recent call last): [translation:ERROR] File "translate.py", line 290, in main [translation:ERROR] drv.proceed(goals) [translation:ERROR] File "/home/dstromberg/src/pypy-src/pypy-for-stock-builds/pypy/translator/driver.py", line 812, in proceed [translation:ERROR] return self._execute(goals, task_skip = self._maybe_skip()) [translation:ERROR] File "/home/dstromberg/src/pypy-src/pypy-for-stock-builds/pypy/translator/tool/taskengine.py", line 116, in _execute [translation:ERROR] res = self._do(goal, taskcallable, *args, **kwds) [translation:ERROR] File "/home/dstromberg/src/pypy-src/pypy-for-stock-builds/pypy/translator/driver.py", line 288, in _do [translation:ERROR] res = func() [translation:ERROR] File "/home/dstromberg/src/pypy-src/pypy-for-stock-builds/pypy/translator/driver.py", line 325, in task_annotate [translation:ERROR] s = annotator.build_types(self.entry_point, self.inputtypes) [translation:ERROR] File "/home/dstromberg/src/pypy-src/pypy-for-stock-builds/pypy/annotation/annrpython.py", line 103, in build_types [translation:ERROR] return self.build_graph_types(flowgraph, inputcells, complete_now=complete_now) [translation:ERROR] File "/home/dstromberg/src/pypy-src/pypy-for-stock-builds/pypy/annotation/annrpython.py", line 194, in build_graph_types [translation:ERROR] self.complete() [translation:ERROR] File "/home/dstromberg/src/pypy-src/pypy-for-stock-builds/pypy/annotation/annrpython.py", line 250, in complete [translation:ERROR] self.processblock(graph, block) [translation:ERROR] File "/home/dstromberg/src/pypy-src/pypy-for-stock-builds/pypy/annotation/annrpython.py", line 473, in processblock [translation:ERROR] self.flowin(graph, block) [translation:ERROR] File "/home/dstromberg/src/pypy-src/pypy-for-stock-builds/pypy/annotation/annrpython.py", line 533, in flowin [translation:ERROR] self.consider_op(block.operations[i]) [translation:ERROR] File "/home/dstromberg/src/pypy-src/pypy-for-stock-builds/pypy/annotation/annrpython.py", line 716, in consider_op [translation:ERROR] argcells = [self.binding(a) for a in op.args] [translation:ERROR] File "/home/dstromberg/src/pypy-src/pypy-for-stock-builds/pypy/annotation/annrpython.py", line 293, in binding [translation:ERROR] return self.bookkeeper.immutableconstant(arg) [translation:ERROR] File "/home/dstromberg/src/pypy-src/pypy-for-stock-builds/pypy/annotation/bookkeeper.py", line 314, in immutableconstant [translation:ERROR] return self.immutablevalue(const.value) [translation:ERROR] File "/home/dstromberg/src/pypy-src/pypy-for-stock-builds/pypy/annotation/bookkeeper.py", line 464, in immutablevalue [translation:ERROR] result = SomePBC([self.getdesc(x)]) [translation:ERROR] File "/home/dstromberg/src/pypy-src/pypy-for-stock-builds/pypy/annotation/bookkeeper.py", line 530, in getdesc [translation:ERROR] pyobj,)) [translation:ERROR] Exception: unexpected prebuilt constant: <built-in function minor> [translation:ERROR] Processing block: [translation:ERROR] bl...@12 is a <class 'pypy.objspace.flow.flowcontext.SpamBlock'> [translation:ERROR] in (pypy.module.posix.interp_posix:179)minor [translation:ERROR] containing the following operations: [translation:ERROR] v775 = simple_call((builtin_function_or_method minor), raw_device_no_0) [translation:ERROR] --end-- [translation] start debugger... _______________________________________________ [email protected] http://codespeak.net/mailman/listinfo/pypy-dev
