Skip to main content

All Questions

Filter by
Sorted by
Tagged with
1 vote
0 answers
86 views

How to let Python runtime load its own Library ZIP file from memory during the initialization

I am using the Python C API and want to embed Python runtime into my app. The first thing is how to let Python load everything from a memory block, which stores the Zipped Python standard library ...
Frank's user avatar
  • 11
1 vote
0 answers
41 views

pyproject.toml: specify dynamic parameters for C extension

I'm updating a Python package that contains some C extensions. In a previous version I had all parameters set up in the setuptools setup() function, and now I am porting that setup into a new version ...
user3758232's user avatar
0 votes
0 answers
120 views

Pytsk3 installed with .whl file does not work

I tried to use pytsk3 in my python project to extract files from .img files. Pytsk3 (https://github.com/py4n6/pytsk) is a python binding for the Sleuth Kit. It works fine on my laptop (windows 11 pro ...
user29792845's user avatar
0 votes
0 answers
42 views

PyEval_RestoreThread crash when calling matplotlib via Python C API

I have a c++ application that implements its own Python interpreter and console. The user can enter Python code into the console, and that text gets sent to another thread where I make calls to the ...
BenMB's user avatar
  • 33
0 votes
0 answers
48 views

import Pytorch to create Neural Network. Running Error

I'm using C++/Qt to run my Qt application. Development Version: Python: 3.12 Qt: 6.6.3 C++: std 17 Visual Studio 2022 Inside my code, I use Python/C API to run python script like: PyObject* pModule ...
Johnson Qing's user avatar
0 votes
1 answer
62 views

Can a simple mutex pthread_mutex be a replacement for GIL in a multithreaded Python C extension?

Can a simple mutex pthread_mutex be a replacement for GIL in a multithreaded Python C extension? For eg: if I put mutex locks around Py_INCREF or PyMem_Alloc, would that suffice? Tried using the GIL, ...
mantle core's user avatar
0 votes
0 answers
59 views

How to build C extensions using free-thread python correctly?

I'm working on a C extension project which will produce a .so or .dll & .pyd file for java to load and call. A part of its function is executing given python code, so I'm trying to make it ...
Beth Zhang's user avatar
1 vote
1 answer
113 views

Create instance of a imported python class with C API

I want to create an instance of a Python class with the C API. My specific use case is the PySerial Object. My Python code would be: import serial test = serial.Serial() I couldn't find any clue or ...
Cutyno's user avatar
  • 215
0 votes
0 answers
55 views

Creating spamtuple instead of spamlist from CPython's xxsubtype.c example template

While in the process of learning the C API for CPython I wanted to modify the xxsubtype.c template example that contains spamlist and spamdict to create spamtuple. The does not work directly, I ...
vand's user avatar
  • 55
1 vote
1 answer
31 views

How to dispose off a partially initialized list in Python C-API?

The documentation for PyList_New says that these two APIs are safe before the list is fully initialized: PyList_SetItem() and PyList_SET_ITEM(). But if an error happens in the middle of initializing ...
John's user avatar
  • 2,038
3 votes
1 answer
96 views

How ro run a C++ application with embedded Python in Debug mode

I'm trying to run the script below in Debug mode (Release works fine). I've linked against python310_d.lib and python310_d.dll which have been built from the source code found here https://github.com/...
Davide Rizzotti's user avatar
0 votes
1 answer
210 views

C++ Python/C API - Is exception returned by PyErr_GetRaisedException normalized?

I'm using a new Python/C API PyErr_GetRaisedException added in 3.12 version to retrieve exception and then using other Python/C APIs to get exception type, value, and traceback details. Then I'm ...
user17562396's user avatar
1 vote
1 answer
39 views

How to debug a dylib error or compiler bug in a Python-C-API function wrapper?

I am writing a Python wrapper for a C function but I have some very strange behaviour. The C code is: static PyObject* f12_wrapper(PyObject* self, PyObject* args, PyObject* kwargs) { PyObject* ...
bourneeoo's user avatar
  • 482
8 votes
1 answer
353 views

How to make CPython report vectorcall as available only when it will actually help performance?

The Vectorcall protocol is a new calling convention for Python's C API defined in PEP 590. The idea is to speed up calls in Python by avoiding the need to build intermediate tuples and dicts, and ...
Chayim Friedman's user avatar
0 votes
0 answers
50 views

PySide6 with Python C API: EXC_BAD_ACCESS error when calling a method with inherited class from QRasterWindow

Environement: Python version: 3.9.6 (default, May 7 2023, 23:32:45) PySide6 version: 6.7.0 When I create an instance of QRasterWindow, calling the metric method is ok: Py_Initialize(); PyObject *...
Blady's user avatar
  • 1

15 30 50 per page
1
2 3 4 5
93