vladexl <vlad...@yandex.ru> added the comment:
Sorry i can't provide simple example, but will describe steps. And also i found reason of such behavior. It was a function from pythonwin: PyWinObject_FromHANDLE. When i removed it from code - issue gone. So, in order to start 2 python scripts simultaneously: 1. 2 interpreters was created (Py_NewInterpreter) 2. 2 windows threads started and 2 python scripts inside (PyRun_AnyFileExFlags(hFile, filePath, true, nullptr); 3. Python scripts like this: (i started additional thread inside python script, it's necessary) @entry def main(): import time i = 100 while i < 103 : print("iter {0} ".format(i)) time.sleep(1) i = i +1 def entry(function): def entry_decorator(): import threading thread = threading.Thread(target=_threadmain, args=(function,)) thread.start() return entry_decorator def _threadmain(function): # call entry point from primary script function() myevent = __mymodule.GetStopEvent() while True: rc = win32event.MsgWaitForMultipleObjects((myevent,), 1, 1000, win32event.QS_ALLINPUT); if rc == win32event.WAIT_OBJECT_0: break pythoncom.PumpWaitingMessages() pythoncom.CoUninitialize() 4. GetStopEvent like this: PyObject* GetStopEvent(PyObject *self, PyObject *args) { HANDLE hEvent = CreateEvent(...); return PyWinObject_FromHANDLE(hEvent); } 5. Exception appears after starting/stopping(firing event) 3..4 times. It works fine in case of single starting. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue45879> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com