Skip to main content
Filter by
Sorted by
Tagged with
1 vote
0 answers
152 views

To be clear, I'm not suggesting anyone actually should import pkg.__init__ directly. This is to understand potential pitfalls if someone decides to convert a module-only distribution into a package, ...
dROOOze's user avatar
  • 4,194
0 votes
0 answers
55 views

I want to use CPython C API but still got this [component_container-1] Traceback (most recent call last): [component_container-1] File "/usr/local/lib/python3.10/dist-packages/numpy/core/...
user900476's user avatar
1 vote
0 answers
40 views

I am trying book cpython internals's example: cpython internals ,you can find it at the page 72, an example that add keyword proceed to pass statement. I am using the newest version of cpython(3.14)...
Kokona's user avatar
  • 11
2 votes
0 answers
122 views

I am doing a reinforcement learning simulation in Python that involves running many episodes and updating the weights of the agent per episode. To speed up the process, I wish to run parallel ...
user1446642's user avatar
0 votes
0 answers
33 views

I’m trying of get a variable value in a CpythonScriptExecutor step in pentaho spoon but i don’t know how to do that. I’ve tried with getVariable(“My_var”, “default_value”) , os.getenv(…) and ${My_var} ...
Liliana's user avatar
0 votes
1 answer
66 views

I am coding with CPython library and embedded Python into my C++ program. I use Python to run scripts and call Py_Initialize and Py_FinalizeEx per run. It works fine until I try to import openai in ...
Mary Guty's user avatar
1 vote
0 answers
71 views

So for the last couple of hours I was trying to figure out a specific issue with multiprocessing when I cythonize my project and have it consist of only .pyd files. The reason I do this is because I ...
Martin Todorov's user avatar
0 votes
1 answer
66 views

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
1 vote
0 answers
57 views

Most Python textbooks and introductory tutorials I have seen say that The result of every expression is some object. But I have also seen several Python sources that say that The result of every ...
Kambal's user avatar
  • 51
1 vote
1 answer
142 views

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
-1 votes
2 answers
119 views

Why is the CPython interpreter not executing the previous statements if an EOL syntax error occurs in a later line? I thought that an interpreter is supposed to execute all the statements in a file ...
tony pd's user avatar
-1 votes
1 answer
104 views

I tried to use CPython in my c++ project, but after running Py_Initialize i got error like below. I'm using python venv, and the initialization code is simple as class PyRuntime { public: ...
slow_mohammud's user avatar
1 vote
1 answer
2k views

There are three vulnerabilities: CVE-2024-45490, CVE-2024-45491 and CVE-2024-45492). It looks, these vulnerabilities get fixed as part of https://github.com/python/cpython/issues/123678 But when I ...
Sumanshu Nankana's user avatar
1 vote
1 answer
186 views

I've been exploring the async source code and noticed that the function _get_running_loop() is defined both in Python and has a note stating it's implemented in C (in _asynciomodule.c). # python3.11/...
OOD Waterball's user avatar
0 votes
1 answer
86 views

I'm working on integrating C code with Python using the Python C API, and I need to register callback functions with additional data. Specifically, I want to pass extra data to my callback function so ...
Սոկրատ Գալստյան's user avatar
5 votes
2 answers
2k views

I did a simple performance test on python 3.12.0 against python 3.13.0b3 compiled with a --disable-gil flag. The program executes calculations of a Fibonacci sequence using ThreadPoolExecutor or ...
K4liber's user avatar
  • 933
0 votes
1 answer
70 views

Let's say I have this Python function: def foo(bar): bar() And this C function void bar() { } How can I create a PyObject with Python C API that holds a pointer to bar function so I can call the ...
Marko Devcic's user avatar
  • 1,099
2 votes
1 answer
115 views

I am attempting to suppress a message that is printed to stdout by a library implemented in C. My specific usecase is OpenCV, so I will use it for the MCVE below. The estimateChessboardSharpness ...
Mad Physicist's user avatar
0 votes
1 answer
172 views

I'm using perf probes to profile the GIL contention in a multithreaded Python application and I find sequences where the take_gil function calls drop_gil as shown in the following perf script dump of ...
Olumide's user avatar
  • 5,905
-3 votes
1 answer
74 views

Could some please walk me through, how CPython parses a file contain just one character 1? In particular, why ast.parse("3") returns ...Expr(...)... as (I believe) Python's source code is a ...
Ecir Hana's user avatar
  • 11.6k
0 votes
1 answer
48 views

This is a weird error I am seeing in a log file in python. import traceback mat = [{"a": 1, "b": 2}, {"a": 3, "b": 4}] def fun(a, b, c): if c is None: ...
Florian's user avatar
  • 663
1 vote
0 answers
46 views

I want to know what would be the "thing" generating/inferring what a C struct's "buffer format string" should be, according to PEP 3118. E.g. if I have some cython code that ...
statskyy's user avatar
  • 353
49 votes
1 answer
2k views

Normally, if you try to pass multiple values for the same keyword argument, you get a TypeError: In [1]: dict(id=1, **{'id': 2}) ------------------------------------------------------------------------...
Waket Zheng's user avatar
  • 6,569
0 votes
1 answer
572 views

I am trying to install python-javabridge (GitHub link) in order to set up a Java virtual machine to house libraries for different file formats that Python can subsequently refer to. However, the ...
TheEponymousProgrammer's user avatar
0 votes
0 answers
89 views

I'm learning C and trying to write an extension to convert COO sparse data to a dense array. (I know SciPy can do it.) But I'm stuck. I can declare the integers for the 2D pointer into the array, ...
user1209675's user avatar

1
2 3 4 5
29