Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #98464 > unrolled thread

Re: how to copy PyObject * memory data to another memory address?

Started byChris Angelico <rosuav@gmail.com>
First post2015-11-09 03:17 +1100
Last post2015-11-09 03:17 +1100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: how to copy PyObject * memory data to another memory address? Chris Angelico <rosuav@gmail.com> - 2015-11-09 03:17 +1100

#98464 — Re: how to copy PyObject * memory data to another memory address?

FromChris Angelico <rosuav@gmail.com>
Date2015-11-09 03:17 +1100
SubjectRe: how to copy PyObject * memory data to another memory address?
Message-ID<mailman.138.1446999430.16136.python-list@python.org>
On Sun, Nov 8, 2015 at 12:23 AM, yueyoum <yueyoum@gmail.com> wrote:
> I'm working on a C program that has Python embedded. The host program is multi processes, which communicate via shared memory (mmap). I create a Python object (e.g., PyDict_New) in one process. How can I copy this data to shared memory so that the other process can obtain this data and convert to Python Object? 发自网易邮箱大师
>

The best way to do this would be to serialize it in some format - JSON
is a good choice, if all your data can fit into that format;
otherwise, consider the Pickle format. Python objects consist of lots
of references to other objects, so it's difficult to transfer them
from one to another as they are. JSON will serve you well.

ChrisA

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web