Stopping embedded Python

后端 未结 3 1354
无人及你
无人及你 2020-12-03 02:58

I\'m embedding Python interpreter to a C program. However, it might happen that while running some python script via PyRun_SimpleString() will run into infinite

3条回答
  •  独厮守ぢ
    2020-12-03 03:29

    Well the python interpreter would have to be running in a separate thread from the embedding program or you will simply never get a chance to interrupt the interpreter.

    When you have that, perhaps you can use one of the Python API exception calls to trigger an exception in the interpreter? See Python C API Exceptions

提交回复
热议问题