|
4 | 4 |
|
5 | 5 | #include "Global.h" |
6 | 6 | #include "engine/EngineManager.h" |
7 | | -#include "engine/EngineOwnData.h" |
8 | 7 | #include "engine/RemoteCall.h" |
9 | 8 | #include "legacy/api/CommandAPI.h" |
10 | | -#include "legacy/api/CommandCompatibleAPI.h" |
11 | | -#include "legacy/api/EventAPI.h" |
12 | 9 | #include "ll/api/utils/StringUtils.h" |
13 | 10 | #include "lse/Entry.h" |
14 | 11 | #include "utils/Utils.h" |
|
18 | 15 | #include <filesystem> |
19 | 16 | #include <toml.h> |
20 | 17 |
|
21 | | -#define PIP_EXECUTE_TIMEOUT 1800 * 1000 |
| 18 | +const unsigned long PIP_EXECUTE_TIMEOUT = 1800 * 1000; |
22 | 19 |
|
23 | 20 | // pre-declare |
24 | 21 | extern void BindAPIs(ScriptEngine* engine); |
@@ -259,60 +256,6 @@ int executePipCommand(std::string cmd) { |
259 | 256 | return exitCode; |
260 | 257 | } |
261 | 258 |
|
262 | | -// This fix is used for Python3.10's bug: |
263 | | -// The thread will freeze when creating a new engine while another thread is |
264 | | -// blocking to read stdin Side effects: sys.stdin cannot be used after this |
265 | | -// patch. More info to see: https://github.com/python/cpython/issues/83526 |
266 | | -// |
267 | | -// Attention! When CPython is upgraded, this fix must be re-adapted or removed!! |
268 | | -// |
269 | | -// namespace FixPython310Stdin { |
270 | | -// // Hard coded function address |
271 | | -// const uintptr_t create_stdio_func_base_offset = 0xCE0F4; |
272 | | - |
273 | | -// create_stdio_func_type create_stdio_original = nullptr; |
274 | | - |
275 | | -// PyObject* create_stdio_hooked( |
276 | | -// const PyConfig* config, |
277 | | -// PyObject* io, |
278 | | -// int fd, |
279 | | -// int write_mode, |
280 | | -// const char* name, |
281 | | -// const wchar_t* encoding, |
282 | | -// const wchar_t* errors |
283 | | -// ) { |
284 | | -// if (fd == 0) { |
285 | | -// Py_RETURN_NONE; |
286 | | -// } |
287 | | -// return create_stdio_original(config, io, fd, write_mode, name, encoding, errors); |
288 | | -// } |
289 | | - |
290 | | -// bool patchPython310CreateStdio() { |
291 | | -// if (create_stdio_original == nullptr) { |
292 | | -// HMODULE hModule = GetModuleHandleW(L"python310.dll"); |
293 | | -// if (hModule == NULL) return false; |
294 | | -// create_stdio_original = (create_stdio_func_type)(void*)(((uintptr_t)hModule) + |
295 | | -// create_stdio_func_base_offset); |
296 | | -// } |
297 | | - |
298 | | -// DetourRestoreAfterWith(); |
299 | | -// if (DetourTransactionBegin() != NO_ERROR) return false; |
300 | | -// else if (DetourUpdateThread(GetCurrentThread()) != NO_ERROR) return false; |
301 | | -// else if (DetourAttach((PVOID*)&create_stdio_original, create_stdio_hooked) != NO_ERROR) return false; |
302 | | -// else if (DetourTransactionCommit() != NO_ERROR) return false; |
303 | | -// return true; |
304 | | -// } |
305 | | - |
306 | | -// bool unpatchPython310CreateStdio() { |
307 | | -// if (DetourTransactionBegin() != NO_ERROR) return false; |
308 | | -// else if (DetourUpdateThread(GetCurrentThread()) != NO_ERROR) return false; |
309 | | -// else if (DetourDetach((PVOID*)&create_stdio_original, create_stdio_hooked) != NO_ERROR) return false; |
310 | | -// else if (DetourTransactionCommit() != NO_ERROR) return false; |
311 | | -// return true; |
312 | | -// } |
313 | | - |
314 | | -// } // namespace FixPython310Stdin |
315 | | - |
316 | 259 | } // namespace PythonHelper |
317 | 260 |
|
318 | 261 | #endif |
0 commit comments