python-c-api
Pass array of structs from Python to C
[Update: Problem solved! See bottom of the post] I need to allow python developers to pass an array of packed data (in this case vertices) into my API, which is a series of C++ interfaces exposed man[详细]
2022-12-20 16:52 分类:问答Access contents of PyBuffer from C
I have created a buffer object in python like so: f = io.open(\'some_file\', \'rb\') byte_stream = buffer(f.read(4096))[详细]
2022-12-18 03:58 分类:问答Python C-API Making len(...) work with extension class
When creating a class in Python, I can simply make a def __len__(self): method to make the len(InstanceOfMyClass) work, however I can\'t find out how to do this with an extension class via the C-API.[详细]
2022-12-17 11:37 分类:问答Python C-API module exit handler - an atexit equivalent?
I\'m using Python 开发者_开发知识库ver 2.6.4 There is a function I have to call from a C library when my extension module exits/is unloaded. What would be the equivalent of atexit for a C extension m[详细]
2022-12-16 21:42 分类:问答Extending Python: pre-load my C module
I\'m trying to extend Python interpreter by a few C functions I wrote. From reading docs, to expose those function the user has to import the module encompassing the functions.[详细]
2022-12-15 01:02 分类:问答Python instance method in C
Consider the following Python (3.x) code: class Foo(object): def bar(self): pass foo = Foo() How to write the same functionality in C?[详细]
2022-12-14 14:49 分类:问答Named parameters with Python C API?
How can I simulate the following Python function using the Python C API? def foo(bar, baz=\"something or other\"):[详细]
2022-12-13 15:10 分类:问答How to create a generator/iterator with the Python C API?
How do I replicate the following Python code with the Python C API? class Sequence(): def __init__(self, max):[详细]
2022-12-12 15:38 分类:问答How to import a file by its full path using C api?
开发者_如何学JAVAPyObject* PyImport_ImportModule( const char *name) How to specify a full file path instead and a module name?[详细]
2022-12-12 06:16 分类:问答Creation of PyTuple in C++ module crashes
Having some trouble with this code. Trying to return a tuple of tuples (coordinates) from a C++ module Im writing. It looks right to me, the dirty list contains two Coords so len is 2, the x and y val[详细]
2022-12-12 02:18 分类:问答