[pypy-dev] cannot use "id" in Rpython
Shubha Ramani
shubharamani at yahoo.com
Fri Dec 30 08:42:18 EST 2016
It's not a bad idea for me. I'm hooking up to a tool made by intel called "vtune" which requires the function name, function size and function address from the original python script code. I got the first two from Python reflection (the way VmProf does it) but I need the third (original script function address). Is __repr__ supported in Rpython ? The string returned by __repr__ contains the Python address at least in Python. If id() doesn't work but __repr__ does then I can use it in the overloaded execute_frame and that should be fine.
Shubha
> On Dec 29, 2016, at 4:29 PM, Ryan Gonzalez <rymg19 at gmail.com> wrote:
>
> What exactly are you trying to do. Using id to get the address of a function is usually a bad idea...
>
> --
> Ryan (ライアン)
> Yoko Shimomura > ryo (supercell/EGOIST) > Hiroyuki Sawano >> everyone else
> http://kirbyfan64.github.io/
>
>> On Dec 29, 2016 1:19 PM, "Shubha Ramani via pypy-dev" <pypy-dev at python.org> wrote:
>>
>> What can I use then ? I need the address of the function ?
>>
>> [translation:ERROR] Exception: cannot use id() in RPython; see objectmodel.compute_xxx()
>> Processing block:
>> block at 19 is a <class 'rpython.flowspace.flowcontext.SpamBlock'>
>> in (pypy.module._vtune.interp_vtune:28)_get_full_name
>> containing the following operations:
>> buf_0 = simple_call((type RStringIO))
>> v943 = getattr(buf_0, ('write'))
>> v944 = getattr(pycode_0, ('co_code'))
>> v945 = simple_call(v943, v944)
>> v946 = getattr(buf_0, ('getsize'))
>> size_code_0 = simple_call(v946)
>> v947 = getattr(pycode_0, ('co_name'))
>> id_func_0 = id(v947)
>> v948 = getattr(pycode_0, ('co_name'))
>> v949 = simple_call((function _safe), v948)
>> v950 = getattr(pycode_0, ('co_firstlineno'))
>> v951 = getattr(pycode_0, ('co_filename'))
>> v952 = simple_call((function _safe), v951)
>> v953 = newtuple(v949, v950, v952, size_code_0, id_func_0)
>> v954 = mod(('vtune:%s:%d:%s:%d:%d'), v953)
>> --end--
>> [translation] start debugger...
>> > /opt/shubha_vtune_pypy/rpython/annotator/unaryop.py(188)id()
>> -> raise Exception("cannot use id() in RPython; "
>> (Pdb+)
>>
>>
>> _______________________________________________
>> pypy-dev mailing list
>> pypy-dev at python.org
>> https://mail.python.org/mailman/listinfo/pypy-dev
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20161230/4075ead3/attachment.html>
More information about the pypy-dev
mailing list