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


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

Re: keeping local state in an C extension module

Started byDaniel Franke <franke.daniel@gmail.com>
First post2011-06-30 15:19 +0200
Last post2011-06-30 15:19 +0200
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: keeping local state in an C extension module Daniel Franke <franke.daniel@gmail.com> - 2011-06-30 15:19 +0200

#8605 — Re: keeping local state in an C extension module

FromDaniel Franke <franke.daniel@gmail.com>
Date2011-06-30 15:19 +0200
SubjectRe: keeping local state in an C extension module
Message-ID<mailman.524.1309439986.1164.python-list@python.org>
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

[toc] | [standalone]


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


csiph-web