aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/pybind/ptr.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/ptr.h
parentca778ad9bfb31839b0f05a4995753bc61db648ad (diff)
downloadydb-5478b8f55cc7055a4861c4030e0c401b5c72714c.tar.gz
Intermediate changes
Diffstat (limited to 'library/cpp/pybind/ptr.h')
-rw-r--r--library/cpp/pybind/ptr.h51
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 e1367366904..00000000000
--- 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();
- }
- };
-
-}