Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #71133 > unrolled thread
| Started by | Simon <simonhf@gmail.com> |
|---|---|
| First post | 2014-05-08 16:12 -0700 |
| Last post | 2014-05-08 16:12 -0700 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
how to create a zero copy external string when binding C to Python? Simon <simonhf@gmail.com> - 2014-05-08 16:12 -0700
| From | Simon <simonhf@gmail.com> |
|---|---|
| Date | 2014-05-08 16:12 -0700 |
| Subject | how to create a zero copy external string when binding C to Python? |
| Message-ID | <e857ca5c-843c-463c-ba00-d4c6bcfd4949@googlegroups.com> |
I'd like to make a C memory buffer available inside Python via the Python C/API without copying that memory into Python. How to do this? I've read [1] but it's not clear that this functionality exists. In javascript it's possible using String::NewExternal() [2]. "Creates a new external string using the ASCII data defined in the given resource. When the external string is no longer live on V8's heap the resource will be disposed by calling its Dispose method. The caller of this function should not otherwise delete or modify the resource. Neither should the underlying buffer be deallocated or modified except through the destructor of the external string resource." [1] https://docs.python.org/2/c-api/buffer.html [2] http://izs.me/v8-docs/classv8_1_1String.html#a07c47bf675b802c550984fa24511a589
Back to top | Article view | comp.lang.python
csiph-web