mixed embedding and cpyext access`

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

mixed embedding and cpyext access`

David Callahan

The Boost libraries in their test jigs use a mixture of an embedded API and direct access to the  methods in Python.h.

Below is an example which compiles with  the py3.5 branch, correctly prints “hello world” but then faults with an message:

“Invalid RPython operation (NULL ptr or bad array index)”.

 

Is this kind of mixing of the two interfaces supported?

Thanks

--david

 

#include <Python.h>

#include <PyPy.h>

 

#include <assert.h>

 

int main() {

  rpython_startup_code();

  int err = pypy_setup_home((char*)"/home/dcallahan/local/pypy",

                            /*verbbose*/1);

  pypy_execute_source("print('hello world')");

  const char *s = "'abcdefg'.upper()";

  PyObject *obj = ::PyUnicode_FromString(s);

  return 0;

}

 

 


_______________________________________________
pypy-dev mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/pypy-dev
Reply | Threaded
Open this post in threaded view
|

Re: mixed embedding and cpyext access`

Armin Rigo-2
Hi David,

On 10 August 2017 at 19:21, David Callahan <[hidden email]> wrote:

> The Boost libraries in their test jigs use a mixture of an embedded API and
> direct access to the  methods in Python.h.
>
> Below is an example which compiles with  the py3.5 branch, correctly prints
> “hello world” but then faults with an message:
>
> “Invalid RPython operation (NULL ptr or bad array index)”.
>
>
>
> Is this kind of mixing of the two interfaces supported?

No.  Our cpyext emulates the C API but doesn't support the embedding
mode of CPython.


A bientôt,

Armin.
_______________________________________________
pypy-dev mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/pypy-dev