Skip to main content
Filter by
Sorted by
Tagged with
1 vote
1 answer
2k views

I am trying to embed python in a GUI application, and so I have a the python interpreter initialized in the main thread of the application, and I may launch python scripts from another one. I read ...
arthropode's user avatar
  • 1,381
1 vote
1 answer
330 views

I am trying to create a python extension to interface python with my C software. Mainly I need to made a big struct from C software accessible and modifiable in python, so I would like to create a ...
arthropode's user avatar
  • 1,381
0 votes
1 answer
344 views

My program crashed with the following message from CPython Debug memory block at address p=0x8a6e80: API '' 0 bytes originally requested The 7 pad bytes at p-7 are not all FORBIDDENBYTE (0xfd):...
user7610's user avatar
  • 29.9k
1 vote
0 answers
676 views

I'm trying to write a test for an extension. The extension uses the python extension (ms-python.python). Therefore I put this in my package.json: "extensionDependencies": [ "ms-...
B3th4's user avatar
  • 113
2 votes
0 answers
1k views

After experimenting with Pybind11 to create C++ extensions for Python, I was hoping to write C++ sections for computationally heavy parts of my code. In my particular case, I would like to work with ...
stillQuestioning's user avatar
1 vote
1 answer
2k views

Background I have an anaconda environment that has Python 3.7 installed. I have a file with some imports out of order which I want VScode to order when pressing CRTL+s. However, instead or ordering ...
Flame_Phoenix's user avatar
4 votes
1 answer
2k views

I have a Python package containing a number of C/C++ extensions built as a single wheel. I'm trying to understand how to ensure the wheel and shared libraries it contains correctly advertise that ...
Jim's user avatar
  • 573
1 vote
0 answers
173 views

Through f2py -c sorting.f90 -m sortF, I get sortF.cpython-37m-x86_64-linux-gnu.so which is great. sorting.f90 module sorting use iso_fortran_env, only: i4 => int32, i8 => int64 implicit ...
ComplicatedPhenomenon's user avatar
2 votes
0 answers
569 views

I want to write a Python C extension that includes a function convertVideo() that converts a video from one format to another making use of FFmpeg 3.4.8 (the libav* libaries). The code of the ...
Christian Vorhemus's user avatar
14 votes
1 answer
936 views

I'm working on a Python C extension and I would like to expose a custom enum (as in: a class inheriting from enum.Enum) that would be entirely defined in C. It turned out to not be a trivial task and ...
Bartosz Golaszewski's user avatar
0 votes
0 answers
478 views

I'm working on a Python package, that wraps a C++ library using Pybind11 + cmake, the code is available at https://github.com/bayesmix-dev/pybmix Since I'm working on Linux, in order to distribute it ...
mariob6's user avatar
  • 529
0 votes
0 answers
64 views

I was reading through this tutorial in order to learn how to write C extension module to define new types. At some point the following tp_init implementation was given: static int Custom_init(...
sifadil's user avatar
  • 33
0 votes
1 answer
302 views

Let's say I built a package with a Python module and an extension module in it, but with the identical name mypackage | +-- __init__.py | +-- mymodule.py | +-- mymodule.cpython-39-x86_64-linux-gnu.so ...
Tetheras's user avatar
0 votes
0 answers
829 views

I've made a python extension with c++ that runs in visual studio. I have 4 files from this: BeeLib.exp BeeLib.lib BeeLib.pdb BeeLib.pyd I want to use these in google colab like I do in visual studio,...
Dom's user avatar
  • 1,467
3 votes
1 answer
392 views

In pure Python, it is relatively simple to define and use a metaclass. class Meta(type): def __new__(cls, name, bases, dict): x = super().__new__(cls, name, bases, dict) print(&...
Edward Z. Yang's user avatar
1 vote
1 answer
230 views

There is a memory leak in my encode method. static const size_t _bits_per_digit = sizeof(digit) * CHAR_BIT; /** * Returns a Python int storing the bitstream of the Elias gamma encoded input list. */...
user avatar
1 vote
1 answer
167 views

https://github.com/python/cpython/blob/master/Include/objimpl.h#L83 says PyObject_Realloc(p != NULL, 0) does not return NULL, or free the memory at p. PyObject_Realloc doesn't free the memory. I've ...
user avatar
0 votes
0 answers
135 views

I created a bit sequence custom type in C typedef struct { PyObject_VAR_HEAD uint8_t data[1]; } BitStream; static PyTypeObject BitStreamType = { PyVarObject_HEAD_INIT(NULL, 0) ....
user avatar
0 votes
1 answer
519 views

I created my own custom Python type. It stores an internal array of bytes. Even when there's no bytes in the array, the object takes up 32 bytes. How can I reduce that? Here's how I defined my type: ...
user avatar
-1 votes
1 answer
2k views

When i write python code on my visual studio code editor i can't find any warnings or errors. I installed python extension, I also change the version of that extension.. I also read many ...
Mahi's user avatar
  • 13
1 vote
1 answer
82 views

Since Python 3 there's no upper limit on the size of an int. I'd like to deal with huge ints of 150+ decimal digits. This is far larger than a unsigned long long is guaranteed to be, so I don't think ...
user avatar
1 vote
1 answer
3k views

msgpack includes an optional cython extension. Some users of the package want py3-none-any wheels of msgpack. I'm trying to figure out how to make it possible to build wheels both with and without the ...
Andrey Bienkowski's user avatar
1 vote
1 answer
148 views

I would like to create a module that uses a non python aware C library and ctypes. According to this documentation about creating a C extension to python, I’m required to provide a module ...
chmike's user avatar
  • 22.4k
5 votes
1 answer
3k views

I have a compiled a Python extension. The resulting binary mylib.so file can be imported in the Python script and works fine. Now I am wondering how to write the interface stub file mylib.pyi such, ...
Matthias's user avatar
  • 1,215
9 votes
1 answer
6k views

I'm trying to create and distribute (with pip) a Python package that has Python code, and C++ code compiled to a .pyd file with Pybind11 (using Visual Studio 2019). I also want to include .pyi stub ...
wolfinabox's user avatar
0 votes
1 answer
154 views

I have a python3 distribution that has one package and also a C extension. I would like to be able to specify the version of the C extension during imports in the tell.py script, but cannot seem to ...
deprekate's user avatar
  • 516
0 votes
1 answer
346 views

this is my code. PyObject *dataPyParams = PyList_New(0); for (int i = 0; i < figdata.dataSetList.size(); i++) { PyObject *pyParams = PyList_New(0); for (int j = 0; j < figdata....
KeyboardMan's user avatar
0 votes
1 answer
528 views

I am adding some Python packages (from pip) to a 3rd-party application's Python interpreter on both Linux and Windows. In the Linux release of their application they compiled Python against GCC 4.xx, ...
user avatar
4 votes
0 answers
1k views

I am wrapping a c++ program via cython and would like to make a vector from this program available in Python. I have written a getter method for the vector, which works fine except that it returns a ...
Samufi's user avatar
  • 2,740
0 votes
1 answer
1k views

I am trying to install the python extension line-profiler via pip on a fresh installation of Anaconda3. As the package requires a compiler, I have installed the Visual Studio Build Tools 2019 along ...
Samufi's user avatar
  • 2,740
0 votes
1 answer
966 views

The function PyObject_Call() is used to call a method on a PyObject. But how to get/read a member variable of a PyObject?
cosas's user avatar
  • 43
0 votes
1 answer
111 views

I created own Python Package in which I want to add own Python C Extension, because in Python Package I'm importing this C-Ext. I want to install it from local files, not pypi. I have dist files of C ...
rozumir's user avatar
  • 905
7 votes
1 answer
4k views

I'm building a C Python extension which makes use of a "third party" library— in this case, one that I've built using a separate build process and toolchain. Call this library libplumbus....
trbabb's user avatar
  • 2,135
0 votes
0 answers
139 views

I'll try to keep it as short as possible. I'm making a python application which uses a C Extension (hw_timer). This extension is in charge of creating a timer. The Python application starts by calling ...
someCoder's user avatar
  • 185
4 votes
2 answers
4k views

I am trying to convert std::string to PyObject. std::string st = jsp.updateRoot(people, people); PyObject* pValue = PyBytes_AsString(st); It is not working using the above method. How can I convert?
batuman's user avatar
  • 7,346
1 vote
0 answers
181 views

I have a python module that I imported to C++ like this : .cpp file: boost::python::object mod; void init_mod(boost::python::object o){ mod = o; } // some code BOOST_PYTHON_MODULE(MyModule){ ...
qwerty_99's user avatar
  • 798
1 vote
1 answer
258 views

How does one define copy and deepcopy methods for a Python type defined in a C extension? Looking at the documentation, there doesn't appear to be a tp_ slot for these methods.
SU3's user avatar
  • 5,499
0 votes
0 answers
245 views

I have a method in python that's implemented like this : class MyClass: def __init__(self, i, j, k): self._i = i self._j = j self._k = k def generate_queue(self, max, ...
qwerty_99's user avatar
  • 798
1 vote
1 answer
386 views

Okay, maybe I'm not finding an answer because I'm not sure how to word it, but I have a class called Info and another class called Packet, both are compiled into Python extensions using boost, and I ...
qwerty_99's user avatar
  • 798
0 votes
0 answers
33 views

So I've finally managed to import the C module into python. However, I'm getting a core dump when I try to access the attribute of an object more than once. Here's the code: node.h: #pragma once #...
qwerty_99's user avatar
  • 798
0 votes
0 answers
47 views

This might have already been posted somewhere else but I couldn't find anything that worked. I have the following libraries / tools installed : boost: boost-python36.x86_64 boost-python36-devel.x86_64 ...
qwerty_99's user avatar
  • 798
4 votes
4 answers
7k views

I tried to install mypy extension in vs code but it keeps showing me this error below C:\Users\Yourusername\Dev\django_project_boilerplate\env\Scripts\python.exe: can't open file 'c:UsersYourusername....
anouar es-sayid's user avatar
1 vote
1 answer
61 views

In my efforts to understand how reference count works in python extensions, I built the following module: #include <Python.h> PyObject *value; static PyObject* pyref_store(PyObject *self, ...
bees's user avatar
  • 11
1 vote
0 answers
227 views

As a part of a Python module I'm writing in C++ I need to make a type containing an std::vector iterable in Python. I added a tp_iter function to the type containing the vector that creates an ...
SU3's user avatar
  • 5,499
1 vote
1 answer
238 views

I have to pass a Python deque to a C++ function but I can't find any documentation on how to convert a deque to a C++ container (for this case, either a deque or a vector would do). Searched ...
qwerty_99's user avatar
  • 798
1 vote
0 answers
161 views

I'm trying to optimize some python code by isolating part of the code into a C++ extension. However, since the code is heavily object-oriented, I'll need to set some attributes as PyObject*. My ...
qwerty_99's user avatar
  • 798
2 votes
2 answers
264 views

I'm writing a Python module in C++. At a certain point, I need to add a PyObject of an arbitrary type to another one. In other words, do the same as a += b would do in Python. But I haven't been able ...
SU3's user avatar
  • 5,499
0 votes
1 answer
984 views

I have a C library I am writing, and my goal is to be able to package and distribute that C library via a python package on PyPI. The concept is, it's a combination of Python code, an extension module,...
Josh Weinstein's user avatar
0 votes
0 answers
237 views

I am working on a Python C-extension code. Currently, a 1D C-array is converted to a Python List. Now I need to convert an ND-array, described by a 1) data type, 2) shape (as a 1D integer vector, for ...
FangQ's user avatar
  • 1,564
0 votes
1 answer
1k views

I am trying to create a numpy array in a python extension. The call of PyArray_SimpleNewFromData gives me a segfault. I am trying to fix it for hours, and now I am the point where I have no more idea ...
Árpád Magosányi's user avatar

1
2
3 4 5
7