aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/pybind/init.h
diff options
context:
space:
mode:
authorprettyboy <prettyboy@yandex-team.com>2023-09-08 00:22:12 +0300
committerprettyboy <prettyboy@yandex-team.com>2023-09-08 00:46:04 +0300
commit3a6cd865171eed9b89bf536cd242285f8b583a91 (patch)
tree25e2756c125f7484fb118e0d5724212199662389 /library/cpp/pybind/init.h
parent67f3f216950849664a29035458cfaa5d12a62846 (diff)
downloadydb-3a6cd865171eed9b89bf536cd242285f8b583a91.tar.gz
[build/plugins/ytest] Allow prebuilt linters for opensource
Без этого, ydb или не сможет запускать flake8 с помощью ya make. Или к ним поедет сборка flake8. Возможно последнее и не так плохо, но сейчас предлагается пока так
Diffstat (limited to 'library/cpp/pybind/init.h')
-rw-r--r--library/cpp/pybind/init.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/library/cpp/pybind/init.h b/library/cpp/pybind/init.h
new file mode 100644
index 00000000000..58874574ed6
--- /dev/null
+++ b/library/cpp/pybind/init.h
@@ -0,0 +1,25 @@
+#pragma once
+
+#define PY_SSIZE_T_CLEAN
+#include <Python.h>
+
+#include "ptr.h"
+
+namespace NPyBind {
+#if PY_MAJOR_VERSION >= 3
+
+#define PYBIND_MODINIT(name) PyMODINIT_FUNC PyInit_##name()
+
+ inline PyObject* ModInitReturn(TPyObjectPtr&& modptr) {
+ return modptr.Release();
+ }
+
+#else
+
+#define PYBIND_MODINIT(name) PyMODINIT_FUNC init##name()
+
+ inline void ModInitReturn(TPyObjectPtr&&) {
+ }
+
+#endif
+}