diff options
author | prettyboy <prettyboy@yandex-team.com> | 2023-09-08 10:08:57 +0300 |
---|---|---|
committer | prettyboy <prettyboy@yandex-team.com> | 2023-09-08 10:39:21 +0300 |
commit | 329f805999a3b41e406959a17cf35ab193ef05a5 (patch) | |
tree | 9a3059df4d544b6c9d6f474344e52f65bd13b4c1 /library/cpp/pybind/embedding.cpp | |
parent | 02ea6261088be81bbc455933cecf8b41726946c1 (diff) | |
download | ydb-329f805999a3b41e406959a17cf35ab193ef05a5.tar.gz |
Revert commit rXXXXXX,[build/plugins/ytest] Allow prebuilt linters for opensource
Diffstat (limited to 'library/cpp/pybind/embedding.cpp')
-rw-r--r-- | library/cpp/pybind/embedding.cpp | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/library/cpp/pybind/embedding.cpp b/library/cpp/pybind/embedding.cpp deleted file mode 100644 index cf8941a92af..00000000000 --- a/library/cpp/pybind/embedding.cpp +++ /dev/null @@ -1,63 +0,0 @@ -#define PY_SSIZE_T_CLEAN -#include <Python.h> - -#include "embedding.h" - -#include <util/generic/ptr.h> -#include <util/generic/yexception.h> - -namespace NPyBind { -#if PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION < 8 - class TDeleteRawMem { - public: - template <typename T> - static inline void Destroy(T* t) noexcept { - PyMem_RawFree(t); - } - }; - - template <typename T> - using TRawMemHolder = THolder<T, TDeleteRawMem>; - - static void SetProgramName(char* name) { - TRawMemHolder<wchar_t> wideName(Py_DecodeLocale(name, nullptr)); - Y_ENSURE(wideName); - Py_SetProgramName(wideName.Get()); - } -#endif - - TEmbedding::TEmbedding(char* argv0) { -#if PY_MAJOR_VERSION < 3 - Py_SetProgramName(argv0); - Py_Initialize(); -#elif PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 8 - PyStatus status; - - PyConfig config; - PyConfig_InitPythonConfig(&config); - // Disable parsing command line arguments - config.parse_argv = 0; - - status = PyConfig_SetBytesString(&config, &config.program_name, argv0); - if (PyStatus_Exception(status)) { - PyConfig_Clear(&config); - Py_ExitStatusException(status); - } - - status = Py_InitializeFromConfig(&config); - if (PyStatus_Exception(status)) { - PyConfig_Clear(&config); - Py_ExitStatusException(status); - } - - PyConfig_Clear(&config); -#elif PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION < 8 - SetProgramName(argv0); - Py_Initialize(); -#endif - } - - TEmbedding::~TEmbedding() { - Py_Finalize(); - } -} |