7 questions
3
votes
1
answer
84
views
str() of a dict subclass does not return "{}" per the MRO
With a class that inherits from dict, why does str() not use dict.__str__ when dict is earlier in the MRO of the class?
Python 3.10.12 (main, Sep 11 2024, 15:47:36) [GCC 11.4.0] on linux
Type "...
0
votes
1
answer
50
views
Reappending threads after starting them
I was just following a tutorial on the usage of subinterpreters in python 3.12 .
In the tutorial there is the following code snippet:
def run_in_threads(total: int = 10):
sub_interpreters = []
...
0
votes
1
answer
343
views
Are Python 3.12 subinterpreters multi-CPU?
Python 3.12 exposes the subinterpreter functionality: after starting the Python main.exe you can spawn multiple subinterpreter threads.
Questions:
As the subinterpreter threads run in the same ...
3
votes
1
answer
194
views
Python Import Module fails using C API if more than one subinterpreter import a module that imports some specific modules
I wrote a single-threaded C++ code using Python C APIs where I start two subinterpreters Sub1 and Sub2, then I load a module M with both.
If M imports certain modules (such as urllib.request or yaml), ...
0
votes
1
answer
739
views
ImportError with Numpy using Python/C 3.12 API subinterpreters
I'm attempting to run a python script that spawns a subinterpreter and a main interpreter, each responsible for doing some sort of work (Based on the example used in this article). The work I'm having ...
0
votes
1
answer
350
views
Multithreading vs linear execution of python code showing absurd results
To my best knowledge if I have a CPU intensive work multithreading should work similar to linear execution of the same code. So I tested it using this simple code.
import datetime
import threading
...
29
votes
3
answers
13k
views
Python multi-thread multi-interpreter C API
I'm playing around with the C API for Python, but it is quite difficult to understand some corner cases. I could test it, but it seems a bug-prone and time consuming. So I come here to see if somebody ...