Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #63690
| Path | csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <mheieis@alois.ca> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.007 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'python3': 0.07; 'returned.': 0.07; 'deprecated': 0.09; 'skip:/ 10': 0.09; 'api': 0.11; 'python': 0.11; 'c-level': 0.16; 'porting': 0.16; 'python3.': 0.16; 'subject: \n ': 0.16; 'memory': 0.22; 'creating': 0.23; 'header:User-Agent:1': 0.23; "haven't": 0.24; '---': 0.24; 'equivalent': 0.26; 'extension': 0.26; 'function': 0.29; 'appreciated.': 0.29; 'direction': 0.30; "i'm": 0.30; 'code': 0.31; 'null;': 0.31; 'subject:the': 0.34; 'received:209.85': 0.35; 'created': 0.35; 'convert': 0.35; 'received:google.com': 0.35; 'subject:?': 0.36; 'should': 0.36; 'received:209': 0.37; 'to:addr:python-list': 0.38; 'guidance': 0.39; 'to:addr:python.org': 0.39; 'new': 0.61; 'subject:. ': 0.67; 'continuous': 0.68 |
| X-Google-DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :subject:content-type:content-transfer-encoding; bh=FgL0S3I2ev85F45V/JzeXo616DEowtYNrAfga5M0Rb8=; b=Mm58ZCkkH8bHXXvi49NPtU0ExtmkWrfMGAnpvIfHBfxdV/CFIcZcx9JNYziI9+ee7k oZSWIZVmknc69eARikF2TXTEFsXQc0sPaR683a0n9q7ug/xORUPyn8QX5zWd0VIF9H+N v1akCbaRhR5FB2mWxOAjt3OsRrctV2DtbdlzLz/omdVcE6YTQ5a13wPTpUDa0m4Z5jtm BP6nY38FelX54UIlY87k0bclahZKibc86YMNJy6KXAhEXYDLzP7e47kWR4DHs8BYPrDn 1gaRt5IxU7bM3cStiqt0kb6OhzsCNyw0jhJ/MJwnkeeqx6DRxS0mhmtWUZVrL3i09IIh K5kw== |
| X-Gm-Message-State | ALoCoQnQZTgSrzFwwzR2fduKExGHlH6eioBfL8ABlrQnaWhAIoHc1+Imvdsgk7OukewVv8VStfiS |
| X-Received | by 10.66.129.133 with SMTP id nw5mr16361756pab.98.1389419224806; Fri, 10 Jan 2014 21:47:04 -0800 (PST) |
| Date | Fri, 10 Jan 2014 21:47:01 -0800 |
| From | Mark Heieis <mheieis@alois.ca> |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Porting c extension - PyBuffer_New() deprecated in python3. What's the replacement? |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Mailman-Approved-At | Sat, 11 Jan 2014 09:32:26 +0100 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.5320.1389429147.18130.python-list@python.org> (permalink) |
| Lines | 42 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1389429147 news.xs4all.nl 2868 [2001:888:2000:d::a6]:41017 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:63690 |
Show key headers only | View raw
Hi
I need to convert the following existing c extension code to support
Python 3.
// --- existing code ------
// PyBuffer_New() deprecated in python3
if (!(pyBuf = PyBuffer_New(len)))
{
return NULL;
}
// should use memoryview object in python3
if (PyObject_AsWriteBuffer(pyBuf, &cbuf, &len))
{
Py_DECREF(pyBuf);
return NULL ;
}
// fill in cbuf
...
return pyBuf ;
//-----------
I'm somewhat confounded in finding an equivalent (PyBuffer_New()) for
creating a buffer of size len that has continuous memory in the c
extension function for python3. cbuf is manipulated/filled in using c,
after which the created pyBuf is then returned. So far, I haven't found
much in the way of examples/doc for porting the deprecated
Python-/C-level buffer API calls to the new C-level buffer
API/memoryview object model.
Any guidance or direction to existing doc/example is much appreciated.
TIA.
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Porting c extension - PyBuffer_New() deprecated in python3. What's the replacement? Mark Heieis <mheieis@alois.ca> - 2014-01-10 21:47 -0800
csiph-web