Skip to content

Commit 711bbe2

Browse files
committed
feat: update python to 3.12.8
1 parent ebe60f5 commit 711bbe2

File tree

3 files changed

+12
-22
lines changed

3 files changed

+12
-22
lines changed

src/legacy/api/EventAPI.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -898,8 +898,6 @@ void InitBasicEventListeners() {
898898
});
899899

900900
// 植入tick
901-
using namespace ll::chrono_literals;
902-
903901
ll::coro::keepThis([]() -> ll::coro::CoroTask<> {
904902
using namespace ll::chrono_literals;
905903

src/legacy/main/PythonHelper.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,18 @@ bool pythonInited = false;
4040
bool initPythonRuntime() {
4141
if (!pythonInited) {
4242
script::py_interop::setPythonHomePath(lse::getSelfPluginInstance().getModDir());
43-
script::py_interop::setModuleSearchPaths({
44-
lse::getSelfPluginInstance().getModDir() / "python310.zip",
45-
lse::getSelfPluginInstance().getModDir() / "DLLs",
46-
lse::getSelfPluginInstance().getModDir() / "Lib",
47-
lse::getSelfPluginInstance().getModDir() / "site-packages",
48-
});
43+
const char* pathEnv = std::getenv("PATH");
44+
auto paths = ll::string_utils::splitByPattern(pathEnv, ";");
45+
std::vector<std::wstring> modulePaths;
46+
for (const auto& p : paths) {
47+
if (p.find("Python") != std::string::npos) {
48+
std::wstring wstr = ll::string_utils::str2wstr(p);
49+
modulePaths.push_back(wstr + L"\\DLLs");
50+
modulePaths.push_back(wstr + L"\\Lib");
51+
modulePaths.push_back(wstr + L"\\site-packages");
52+
}
53+
}
54+
script::py_interop::setModuleSearchPaths(modulePaths);
4955
pythonInited = true;
5056
}
5157
return true;

src/legacy/main/PythonHelper.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,6 @@ bool processPythonDebugEngine(const std::string& cmd);
2121
bool processConsolePipCmd(const std::string& cmd);
2222
int executePipCommand(std::string cmd);
2323

24-
// This fix is used for Python3.10's bug:
25-
// The thread will freeze when creating a new engine while another thread is
26-
// blocking to read stdin Side effects: sys.stdin cannot be used after this
27-
// patch. More info to see: https://github.com/python/cpython/issues/83526
28-
//
29-
// Attention! When CPython is upgraded, this fix must be re-adapted or removed!!
30-
//
31-
namespace FixPython310Stdin {
32-
33-
bool patchPython310CreateStdio();
34-
bool unpatchPython310CreateStdio();
35-
36-
} // namespace FixPython310Stdin
37-
3824
} // namespace PythonHelper
3925

4026
#endif

0 commit comments

Comments
 (0)