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


Groups > comp.lang.python > #71132

how to create an external string when binding C to Python?

X-Received by 10.182.24.104 with SMTP id t8mr3352961obf.34.1399590643174; Thu, 08 May 2014 16:10:43 -0700 (PDT)
X-Received by 10.50.112.137 with SMTP id iq9mr16742igb.8.1399590642932; Thu, 08 May 2014 16:10:42 -0700 (PDT)
Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!c1no3331198igq.0!news-out.google.com!gi6ni790igc.0!nntp.google.com!c1no3331191igq.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.lang.python
Date Thu, 8 May 2014 16:10:42 -0700 (PDT)
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=96.48.19.132; posting-account=ik1CaQoAAADPdteGm4HKvrrFOmR6_E2M
NNTP-Posting-Host 96.48.19.132
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <3afe7539-e3e9-43d6-ab58-1f4aa7895b46@googlegroups.com> (permalink)
Subject how to create an external string when binding C to Python?
From Simon <simonhf@gmail.com>
Injection-Date Thu, 08 May 2014 23:10:42 +0000
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
Xref csiph.com comp.lang.python:71132

Show key headers only | View raw


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 comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

how to create an external string when binding C to Python? Simon <simonhf@gmail.com> - 2014-05-08 16:10 -0700
  Re: how to create an external string when binding C to Python? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-05-09 00:46 +0100
  Re: how to create an external string when binding C to Python? Ian Kelly <ian.g.kelly@gmail.com> - 2014-05-08 19:25 -0600

csiph-web