Detecting all prime numbers in given range is supposed to performed by C++ code code below as a procedure invoked from Python. Tested with both Python 3.9.5 and Python 3.10 (beta) via Python API. Refactoring code proposed in python-cpp-extension@github
Source: LXer – Create Basic Python 3.10(beta) C++ Extensions on Fedora Linux 34