python-c-extension Questions

1

Solved

If I have the following function and the optional argument myobj is not passed, does myobj remain NULL or is it set to Py_None? static PyObject * myfunc(PyObject * self, PyObject * args) { PyObje...
Binal asked 11/4, 2012 at 19:33

1

Solved

I'm trying to figure out how to use the Python interpreter from C, and I'm having trouble with PyEval_EvalCode. Basically, I'm writing a C function which takes in an arbitrary string of Python code...
Obscenity asked 5/3, 2012 at 20:22

2

Solved

I'm trying to find out what's the reason of error: Unable to find vcvarsall.bat after pip install greenlet. I'd like to set log level used by distutils so that debug messages like log.debug("Unable...
Fragmental asked 2/1, 2012 at 13:46

4

Solved

I have a Python extension written in C and I wonder if I should use the file extension DLL or PYD under Windows. (And what would I use in Linux?) Are there any differences (besides the filename)? ...
Takeover asked 24/11, 2011 at 22:3

4

Solved

Let's suppose I have a C extension function that does something that is completely independent of the Python interpreter. Is there any reason not to release the GIL? For example, is there any reas...
Kaplan asked 21/10, 2011 at 23:59

1

Solved

When creating a C extension to Python, is it possible to be able to somehow write comments that are exposed as docstrings to users of the extension?
Guile asked 6/6, 2011 at 23:20

1

I've read the documentation for the Python C-API, and even written a few extension modules. However, I'm still a bit unclear on the exact semantics when it comes to returning Python objects from a ...
Sherwood asked 30/5, 2011 at 13:6

2

Solved

I've created a C extension that I'd like to enable in my Python package (using setuptools) only if a command line option is passed in. What is the easiest way to do this? I can't seem to find any ...
Proulx asked 30/10, 2010 at 0:11

3

I need to have an array of python objects to be used in creating a trie datastructure. I need a structure that will be fixed-length like a tuple and mutable like a list. I don't want to use a list ...
Pesek asked 28/1, 2011 at 23:32

3

Solved

I'm reading the documentation for Memory Management in Python C extensions, and as far as I can tell, there doesn't really seem to be much reason to use malloc rather than PyMem_Malloc. Say I want ...
Soren asked 27/1, 2011 at 23:9

5

I want to run a cpu intensive program in Python across multiple cores and am trying to figure out how to write C extensions to do this. Are there any code samples or tutorials on this?
Smaltite asked 18/8, 2010 at 16:46

1

Solved

I have some code to interface Python to C++ which works fine but every time I look at it I think there must be a better way to do it. On the C++ side there is a 'variant' type that can deal with a ...
Kittie asked 22/6, 2010 at 11:53

1

Solved

I've taken a library that is distributed as a binary lib (.a) and header, written some c++ code against it, and want to wrap the results up in a python module. I've done this here. The problem i...
Scission asked 7/5, 2010 at 16:46

1

Solved

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 module?
Splint asked 18/1, 2010 at 2:4

4

Solved

The Python manual says that you can create modules for Python in both C and C++. Can you take advantage of things like classes and templates when using C++? Wouldn't it create incompatibilities wit...
Rauwolfia asked 26/7, 2009 at 23:30

© 2022 - 2024 — McMap. All rights reserved.