aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/pybind/ptr.h
diff options
context:
space:
mode:
authorprettyboy <prettyboy@yandex-team.com>2023-09-08 10:08:57 +0300
committerprettyboy <prettyboy@yandex-team.com>2023-09-08 10:39:21 +0300
commit329f805999a3b41e406959a17cf35ab193ef05a5 (patch)
tree9a3059df4d544b6c9d6f474344e52f65bd13b4c1 /library/cpp/pybind/ptr.h
parent02ea6261088be81bbc455933cecf8b41726946c1 (diff)
downloadydb-329f805999a3b41e406959a17cf35ab193ef05a5.tar.gz
Revert commit rXXXXXX,[build/plugins/ytest] Allow prebuilt linters for opensource
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();
- }
- };
-
-}