python-c-extension Questions
6
Solved
I am trying to compile the example from the docs https://docs.python.org/2.7/extending/embedding.html and my code looks exactly like the one under 5.1:
#include <Python.h>
int
main(int argc...
Zoospore asked 27/12, 2014 at 23:57
2
Solved
I am trying to figure out how in C extension modules to have a variable (and maybe) quite large number of arguments to a function.
Reading about PyArg_ParseTuple it seems you have to know how many...
Superbomb asked 3/11, 2011 at 21:12
2
Solved
If I'm understanding correctly,
PyMODINIT_FUNC in Python 2.X has been replaced by PyModule_Create in Python3.X
Both return PyObject*, however, in Python 3.X, the module's initialization function...
Disentail asked 9/5, 2012 at 3:18
2
Solved
I've am learning about Python-C extensions and am puzzled as to why methods that use keyword arguments must be cast to PyCFunctions.
My understanding of a PyCFunction is that it takes two pointers...
Plauen asked 21/4, 2012 at 23:54
7
Solved
I've tried to debug memory crash in my Python C extension and tried to run script under valgrind. I found there is too much "noise" in the valgrind output, even if I've ran simple command as:
valg...
Noranorah asked 5/10, 2009 at 10:25
2
TLDR;
To run an initialization function for each process that is spawned by celery, you can use the worker_process_init signal. As you can read in the docs, handlers for that signal should not be ...
Instate asked 13/6, 2014 at 10:6
5
Solved
What is the correct or most robust way to tell from Python if an imported module comes from a C extension as opposed to a pure Python module? This is useful, for example, if a Python package has a ...
Presumptuous asked 2/12, 2013 at 22:18
3
Solved
I'm writing a Python 2.7 extension module in Cython. How do I create a Python object implementing the new-style buffer interface that wraps a chunk of memory given to me by a C library? The chunk o...
Jaworski asked 26/1, 2015 at 23:2
2
Solved
Python's inspect module doesn't seem to be able to inspect the signatures of "built-in" functions, which include functions defined in C extension modules, like those defined by Cython. Is there any...
Decretive asked 4/9, 2017 at 8:39
2
Solved
How can I write a Cython function that takes a byte string object (a normal string, a bytearray, or another object that follows the buffer protocol) as a typed memoryview?
According to the Unicode...
Scorch asked 28/1, 2015 at 22:28
2
Solved
I have a distutils setup script with an Extension section, which looks something like this:
from distutils.core import setup, Extension
my_module = Extension('my_module',
sources = ['my_file.c',...
Overdrive asked 24/2, 2011 at 11:26
1
Solved
I define a function in C library as follows:
int* Test(char *str1,int id1,char *str2,float val,float *ls)
I want to use it in python so I write the following python code:
str1 = 'a'
str2 = 'b'
...
Jevons asked 10/4, 2017 at 7:41
1
Solved
My makefile:
SHELL := /bin/bash
.PHONY: all
all:
pip install runcython
makecython++ stitch_wrapper.pyx "" "stitch_rects.cpp ./hungarian/hungarian.cpp"
hungarian: hungarian/hungarian.so
hungar...
Orthodoxy asked 27/3, 2017 at 1:34
2
I have been trying to get to grips with extending python with C, and so far, based on the documentation, I have had reasonable success in writing small C functions and extending it with Python.
Ho...
Amy asked 17/3, 2014 at 15:22
7
Solved
Basically there seems to be massive confusion/ambiguity over when exactly PyEval_InitThreads() is supposed to be called, and what accompanying API calls are needed. The official Python documentatio...
Scutari asked 18/3, 2013 at 5:37
2
Solved
I've been trying to learn how to write C-extensions for Python and want to be sure I understand how PyArg_ParseTupleAndKeywords works.
I believe that the first argument is a PyObject pointer that...
Scull asked 16/5, 2012 at 20:3
1
I wrote a python library with two parts:
A Python C extension
A Python wrapper for the Python C extension
I would like to be able to package it in such a way that the Python wrapper is th...
Suspiration asked 5/2, 2017 at 4:4
1
Solved
I'm working through the Python C Extension documentation for defining new types and just finished the Providing finer control over data attributes section.
In this section, they change the example...
Decasyllable asked 28/1, 2017 at 21:59
0
I have a python module called my_module, within it I have a class called my_class and my_class has a classmethod called my_method.
Based on other examples I have seen around I have come up with th...
Nocti asked 29/9, 2016 at 16:30
3
After uploading a binary distribution of my Python C extension with python setup.py bdist upload, easy_install [my-package-name] fails on "error: Couldn't find a setup script in /tmp/easy_install/p...
Fecit asked 30/5, 2011 at 16:29
5
Solved
I have a C file that has a bunch of #defines for bits that I'd like to reference from python. There's enough of them that I'd rather not copy them into my python code, instead is there an accepted ...
Sarnoff asked 27/8, 2012 at 18:22
3
Solved
I just upgraded from Snow Leopard to Lion, and an old python c-extension that I had to update didn't want to compile properly. I don't really know what to do here. Anyone who could help me out so i...
Vanden asked 27/7, 2011 at 5:26
1
I have source code for an extension in Python. I want to see debug symbols for that extension when I debug it. How do I tell PIP to compile and link debug symbols for my extension?
(Preferably pla...
Warehouseman asked 10/5, 2015 at 16:42
1
I'm getting an error output when I call the C-API's Py_Finalize() from a different C-thread than I made a python call on.
The error I'm seeing is:
Exception ignored in: <module 'threading' fro...
Tetrasyllable asked 8/1, 2015 at 16:17
1
Solved
There is a thinning pip package that is currently getting compiled only with Python2.
When I install it with sudo pip install thinning and then attempt to import thinning, I get an error:
ImportE...
Alitaalitha asked 19/1, 2016 at 8:1
1 Next >
© 2022 - 2024 — McMap. All rights reserved.