diff options
author | qrort <qrort@yandex-team.com> | 2022-12-02 11:31:25 +0300 |
---|---|---|
committer | qrort <qrort@yandex-team.com> | 2022-12-02 11:31:25 +0300 |
commit | b1f4ffc9c8abff3ba58dc1ec9a9f92d2f0de6806 (patch) | |
tree | 2a23209faf0fea5586a6d4b9cee60d1b318d29fe /library/cpp/pybind | |
parent | 559174a9144de40d6bb3997ea4073c82289b4974 (diff) | |
download | ydb-b1f4ffc9c8abff3ba58dc1ec9a9f92d2f0de6806.tar.gz |
remove kikimr/driver DEPENDS
Diffstat (limited to 'library/cpp/pybind')
-rw-r--r-- | library/cpp/pybind/ptr.h | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/library/cpp/pybind/ptr.h b/library/cpp/pybind/ptr.h deleted file mode 100644 index e136736690..0000000000 --- a/library/cpp/pybind/ptr.h +++ /dev/null @@ -1,51 +0,0 @@ -#pragma once - -#define PY_SSIZE_T_CLEAN -#include <Python.h> -#include <util/generic/ptr.h> - -namespace NPyBind { - template <class T> - class TPythonIntrusivePtrOps { - public: - static inline void Ref(T* t) noexcept { - Py_XINCREF(t); - } - - static inline void UnRef(T* t) noexcept { - Py_XDECREF(t); - } - - static inline void DecRef(T* t) noexcept { - Py_XDECREF(t); - } - }; - - class TPyObjectPtr: public TIntrusivePtr<PyObject, TPythonIntrusivePtrOps<PyObject>> { - private: - typedef TIntrusivePtr<PyObject, TPythonIntrusivePtrOps<PyObject>> TParent; - typedef TPythonIntrusivePtrOps<PyObject> TOps; - - public: - inline TPyObjectPtr() noexcept { - } - - inline explicit TPyObjectPtr(PyObject* obj) noexcept - : TParent(obj) - { - } - - inline TPyObjectPtr(PyObject* obj, bool unref) noexcept - : TParent(obj) - { - if (unref) - TOps::UnRef(TParent::Get()); - } - - inline PyObject* RefGet() { - TOps::Ref(TParent::Get()); - return TParent::Get(); - } - }; - -} |