Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #8605
| References | <CAJ+j52Ye6s02v7i7D+U-qNWCEFMc_gaOJJgV2Xjvd1TaovzMoQ@mail.gmail.com> <iuhj82$mgf$1@dough.gmane.org> <CAJ+j52YYLormXbmSfdT7fRxE4sO2UjMSSNQQgMkKDNY1PpufFQ@mail.gmail.com> <iuhsk0$grk$1@dough.gmane.org> |
|---|---|
| Date | 2011-06-30 15:19 +0200 |
| Subject | Re: keeping local state in an C extension module |
| From | Daniel Franke <franke.daniel@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.524.1309439986.1164.python-list@python.org> (permalink) |
2011/6/30 Stefan Behnel <stefan_ml@behnel.de>:
>> If there are too many hoops to jump through to get a reasonable
>> solution working for 2.[567], I might as well go back to
>> Py_InitModule() and static variables. It's somewhat ugly, but it
>> works.
>
> Py2.x has a PyCObject, basically the predecessor to PyCapsule. Writing your
> own little type is another option.
For reference: PyCObject has PyCObject_FromVoidPtr() and
PyCObject_AsVoidPtr() -- exactly what I was looking for (no idea why I
missed it for so long?!). Ok, and it also has the note: "The CObject
API is deprecated as of Python 2.7. Please switch to the new Capsules
API." which is of no concern here :)
Thanks heaps!
Daniel
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: keeping local state in an C extension module Daniel Franke <franke.daniel@gmail.com> - 2011-06-30 15:19 +0200
csiph-web