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/pod.h | |
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/pod.h')
-rw-r--r-- | library/cpp/pybind/pod.h | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/library/cpp/pybind/pod.h b/library/cpp/pybind/pod.h deleted file mode 100644 index 90165fdbec6..00000000000 --- a/library/cpp/pybind/pod.h +++ /dev/null @@ -1,53 +0,0 @@ -#pragma once - -#define PY_SSIZE_T_CLEAN -#include <Python.h> -#include "attr.h" -#include "typedesc.h" - -namespace NPyBind { - struct TPOD { - TPyObjectPtr Dict; - - TPOD() - : Dict(PyDict_New(), true) - { - } - bool SetAttr(const char* name, PyObject* value) { - return PyDict_SetItemString(Dict.Get(), name, value) == 0; - } - PyObject* GetAttr(const char* name) const { - PyObject* res = PyDict_GetItemString(Dict.Get(), name); - Py_XINCREF(res); - return res; - } - }; - - class TPODTraits: public NPyBind::TPythonType<TPOD, TPOD, TPODTraits> { - private: - typedef TPythonType<TPOD, TPOD, TPODTraits> MyParent; - friend class TPythonType<TPOD, TPOD, TPODTraits>; - TPODTraits(); - - public: - static TPOD* GetObject(TPOD& obj) { - return &obj; - } - }; - - template <> - inline bool FromPyObject<TPOD*>(PyObject* obj, TPOD*& res) { - res = TPODTraits::CastToObject(obj); - if (res == nullptr) - return false; - return true; - } - template <> - inline bool FromPyObject<const TPOD*>(PyObject* obj, const TPOD*& res) { - res = TPODTraits::CastToObject(obj); - if (res == nullptr) - return false; - return true; - } - -} |