aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/pybind/pod.h
diff options
context:
space:
mode:
authorrobot-piglet <robot-piglet@yandex-team.com>2023-10-03 15:02:38 +0300
committerrobot-piglet <robot-piglet@yandex-team.com>2023-10-03 16:04:35 +0300
commit5478b8f55cc7055a4861c4030e0c401b5c72714c (patch)
tree3d003e5b4c1800297fcc491faffc9a006d174289 /library/cpp/pybind/pod.h
parentca778ad9bfb31839b0f05a4995753bc61db648ad (diff)
downloadydb-5478b8f55cc7055a4861c4030e0c401b5c72714c.tar.gz
Intermediate changes
Diffstat (limited to 'library/cpp/pybind/pod.h')
-rw-r--r--library/cpp/pybind/pod.h53
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;
- }
-
-}