[PyPy-issue] [issue687] Patch to make the generated C filenames reflect the RPython source filenames
Dave Malcolm
pypy-dev-issue at codespeak.net
Tue Apr 19 17:59:14 CEST 2011
Dave Malcolm <dmalcolm at redhat.com> added the comment:
As it turned out, the full translation failed (after 2 hours...), with a bug that's easily reproducible by pypy/translator/c/test/test_stackless.py : it
seems that not all FunctionGraph instances have a "func" attribute, and thus attempts to call access "filename" or call getfilename fail (likewise for the
various other func-based properties).
I'm attaching a modified version of the patch which bulletproofs it against such FunctionGraph instances. With this, all of the tests below
pypy/translator/c/test pass; I have a full translation (with --opt=jit) running now.
I'm not sure yet how common such FunctionGraph instances are. I saw this in a full translation with this object:
(Pdb+) p node
<pypy.translator.c.node.FuncNode object at 0x9d4c9b40>
(Pdb+) p node.obj
<fn dispatcher>
with this generated code:
struct pypy_pypy_interpreter_baseobjspace_W_Root0 *pypy_g_dispatcher(char l_v105, struct pypy_pypy_objspace_std_dictmultiobject_W_DictMultiObjec0
*l_v1810, struct pypy_rpy_string0 *l_key_345) {
(I have the full function saved, in case that's helpful)
I saw it with pypy/translator/c/test/test_stackless.py with this object:
(Pdb) p self
<FunctionGraph of save_empty_state at 0x534090a0>
For reference, here's the traceback:
[translation:ERROR] Error:
[translation:ERROR] Traceback (most recent call last):
[translation:ERROR] File "translate.py", line 299, in main
[translation:ERROR] drv.proceed(goals)
[translation:ERROR] File "/home/david/coding/pypy-dmalcolm-bitbucket/pypy-c-filenames/pypy/translator/driver.py", line 809, in proceed
[translation:ERROR] return self._execute(goals, task_skip = self._maybe_skip())
[translation:ERROR] File "/home/david/coding/pypy-dmalcolm-bitbucket/pypy-c-filenames/pypy/translator/tool/taskengine.py", line 116, in _execute
[translation:ERROR] res = self._do(goal, taskcallable, *args, **kwds)
[translation:ERROR] File "/home/david/coding/pypy-dmalcolm-bitbucket/pypy-c-filenames/pypy/translator/driver.py", line 286, in _do
[translation:ERROR] res = func()
[translation:ERROR] File "/home/david/coding/pypy-dmalcolm-bitbucket/pypy-c-filenames/pypy/translator/driver.py", line 530, in task_source_c
[translation:ERROR] exe_name=exe_name)
[translation:ERROR] File "/home/david/coding/pypy-dmalcolm-bitbucket/pypy-c-filenames/pypy/translator/c/genc.py", line 270, in generate_source
[translation:ERROR] defines = defines)
[translation:ERROR] File "/home/david/coding/pypy-dmalcolm-bitbucket/pypy-c-filenames/pypy/translator/c/genc.py", line 975, in gen_source_standalone
[translation:ERROR] sg.gen_readable_parts_of_source(f)
[translation:ERROR] File "/home/david/coding/pypy-dmalcolm-bitbucket/pypy-c-filenames/pypy/translator/c/genc.py", line 824, in
gen_readable_parts_of_source
[translation:ERROR] split_criteria_big):
[translation:ERROR] File "/home/david/coding/pypy-dmalcolm-bitbucket/pypy-c-filenames/pypy/translator/c/genc.py", line 714, in splitnodesimpl
[translation:ERROR] c_filename = self.getbasecfilefornode(node, basecname)
[translation:ERROR] File "/home/david/coding/pypy-dmalcolm-bitbucket/pypy-c-filenames/pypy/translator/c/genc.py", line 701, in getbasecfilefornode
[translation:ERROR] if node.obj.graph.filename.endswith('.py'):
[translation:ERROR] File "/home/david/coding/pypy-dmalcolm-bitbucket/pypy-c-filenames/pypy/tool/descriptor.py", line 9, in __get__
[translation:ERROR] return self.getter(obj)
[translation:ERROR] File "/home/david/coding/pypy-dmalcolm-bitbucket/pypy-c-filenames/pypy/objspace/flow/model.py", line 73, in getfilename
[translation:ERROR] return self.func.func_code.co_filename
[translation:ERROR] AttributeError: 'FunctionGraph' object has no attribute 'func'
----------
status: unread -> chatting
_______________________________________________________
PyPy development tracker <pypy-dev-issue at codespeak.net>
<https://codespeak.net/issue/pypy-dev/issue687>
_______________________________________________________
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pypy-make-c-filenames-reflect-rpython-filenames-v2.patch
Type: text/x-patch
Size: 4088 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/pypy-issue/attachments/20110419/e5c09614/attachment.bin>
More information about the Pypy-issue
mailing list