Re: [pypy-dev] For embedding pypy, how to deal with None value

2015-05-19 Thread Armin Rigo
Hi Ryan, On 19 May 2015 at 20:09, Ryan Gonzalez wrote: > Why not return a pointer to a double? Like (UNTESTED!): > > d = ffi.new('double*') > d[0] = 9.0 > return d This doesn't work! You can't return a ffi.new() pointer, because the 'd' variable is not kept alive. >>> The document Embedding Py

Re: [pypy-dev] For embedding pypy, how to deal with None value

2015-05-19 Thread Ryan Gonzalez
Why not return a pointer to a double? Like (UNTESTED!): d = ffi.new('double*') d[0] = 9.0 return d Then you could return None, which is converted to a C NULL (same thing other way around). On May 19, 2015 11:27:28 AM CDT, Yicong Huang wrote: >One approach we thought of is to use additional int

Re: [pypy-dev] Exclude modules and functions from building libpypy.so

2015-05-19 Thread Yury V. Zaytsev
On Tue, 2015-05-19 at 13:29 +0800, Yicong Huang wrote: > For pypy 2.5.1, the default buiding of libpypy-c.so is about 99MB. Did you check whether it includes the debug information or not? If yes (which looks quite likely, judging by the size), then you can strip it and this alone will get you a hu

Re: [pypy-dev] For embedding pypy, how to deal with None value

2015-05-19 Thread Yicong Huang
One approach we thought of is to use additional int pointer to indicate whether the value is None. ffi.cdef('''struct API {double (*add_numbers)(double x, double y); int *ret}; And then wrap the python function, if the return value is None, set ret[0] to 1. On Tue, May 19, 2015 at 11:

[pypy-dev] For embedding pypy, how to deal with None value

2015-05-19 Thread Yicong Huang
The document Embedding PyPy shows good examples, but did not tell how to deal with None value. As Python support None value, it might bring some troubles: 1. How to pass NULL from C to python for None? 2. If python function return None, how to handle the issue in C? For the above cases, we observe

Re: [pypy-dev] Could PyPy be embeded running in sanbox?

2015-05-19 Thread Armin Rigo
Hi Yicong, On 16 May 2015 at 07:42, Yicong Huang wrote: > I quite agree with you that cfii is very powerful and should not include in > sandbox. > However, could we consider include a small subset of cffi? No. Anything that cffi enables lets you read random memory, or write random memory, or ca

[pypy-dev] [CFP] DLS 2015

2015-05-19 Thread Manuel . Serrano
- C A L L F O R P A P E R S - DLS 2015 === 11th Dynamic Languages Symposium

Re: [pypy-dev] Exclude modules and functions from building libpypy.so

2015-05-19 Thread Maciej Fijalkowski
there are compilation options like --withoutmod-_md5 and so on. No, you can't disable single functions. On Tue, May 19, 2015 at 7:29 AM, Yicong Huang wrote: > For pypy 2.5.1, the default buiding of libpypy-c.so is about 99MB. > To my understanding, libypypy.so includes standard python libs. > If