aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/pybind/ptr.h
diff options
context:
space:
mode:
authorsay <say@yandex-team.com>2023-03-31 10:07:15 +0300
committersay <say@yandex-team.com>2023-03-31 10:07:15 +0300
commite163b69a87c70baac07bd99142916735e0c283fa (patch)
tree73e22c0f9e975ff6dc70f38534ec84588587d25c /library/cpp/pybind/ptr.h
parent6be8bf780352147bcac5afec43505883b69229a0 (diff)
downloadydb-e163b69a87c70baac07bd99142916735e0c283fa.tar.gz
Swith flake8 to custom lint schema
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();
- }
- };
-
-}