[pypy-dev] mixed embedding and cpyext access`

David Callahan dcallahan at fb.com
Thu Aug 10 13:21:32 EDT 2017


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;
}


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20170810/6b40b6fe/attachment.html>


More information about the pypy-dev mailing list