|
Zdenek Dohnal |
74af86 |
From 939e0db21a5145d6a84eb8922ba3dc3a14fb4572 Mon Sep 17 00:00:00 2001
|
|
Zdenek Dohnal |
74af86 |
From: Zdenek Dohnal <zdohnal@redhat.com>
|
|
Zdenek Dohnal |
74af86 |
Date: Wed, 12 Jul 2023 13:13:38 +0200
|
|
Zdenek Dohnal |
74af86 |
Subject: [PATCH] if_python3.c: Fix building dynamic Python3 interpreter
|
|
Zdenek Dohnal |
74af86 |
|
|
Zdenek Dohnal |
74af86 |
There are new extern global variables defined in python3 development
|
|
Zdenek Dohnal |
74af86 |
files, which types are within python3 library, so they break dynamic
|
|
Zdenek Dohnal |
74af86 |
python3 interpret Vim plugin.
|
|
Zdenek Dohnal |
74af86 |
|
|
Zdenek Dohnal |
74af86 |
Since the variables are used in macro `Py_SIZE` which is used in other
|
|
Zdenek Dohnal |
74af86 |
python3 headers, the dummy variables have to defined before including
|
|
Zdenek Dohnal |
74af86 |
Python.h.
|
|
Zdenek Dohnal |
74af86 |
---
|
|
Zdenek Dohnal |
74af86 |
src/if_python3.c | 11 +++++++++--
|
|
Zdenek Dohnal |
74af86 |
1 file changed, 9 insertions(+), 2 deletions(-)
|
|
Zdenek Dohnal |
74af86 |
|
|
Zdenek Dohnal |
74af86 |
diff --git a/src/if_python3.c b/src/if_python3.c
|
|
Zdenek Dohnal |
74af86 |
index 240b88fac..f6704a31e 100644
|
|
Zdenek Dohnal |
74af86 |
--- a/src/if_python3.c
|
|
Zdenek Dohnal |
74af86 |
+++ b/src/if_python3.c
|
|
Zdenek Dohnal |
74af86 |
@@ -68,6 +68,8 @@
|
|
Zdenek Dohnal |
74af86 |
#endif
|
|
Zdenek Dohnal |
74af86 |
|
|
Zdenek Dohnal |
74af86 |
#define PY_SSIZE_T_CLEAN
|
|
Zdenek Dohnal |
74af86 |
+#define PyLong_Type (*py3_PyLong_Type)
|
|
Zdenek Dohnal |
74af86 |
+#define PyBool_Type (*py3_PyBool_Type)
|
|
Zdenek Dohnal |
74af86 |
|
|
Zdenek Dohnal |
74af86 |
#include <Python.h>
|
|
Zdenek Dohnal |
74af86 |
|
|
Zdenek Dohnal |
74af86 |
@@ -270,7 +272,6 @@ static HINSTANCE hinstPy3 = 0; // Instance of python.dll
|
|
Zdenek Dohnal |
74af86 |
# define PyFloat_Type (*py3_PyFloat_Type)
|
|
Zdenek Dohnal |
74af86 |
# define PyNumber_Check (*py3_PyNumber_Check)
|
|
Zdenek Dohnal |
74af86 |
# define PyNumber_Long (*py3_PyNumber_Long)
|
|
Zdenek Dohnal |
74af86 |
-# define PyBool_Type (*py3_PyBool_Type)
|
|
Zdenek Dohnal |
74af86 |
# define PyErr_NewException py3_PyErr_NewException
|
|
Zdenek Dohnal |
74af86 |
# ifdef Py_DEBUG
|
|
Zdenek Dohnal |
74af86 |
# define _Py_NegativeRefcount py3__Py_NegativeRefcount
|
|
Zdenek Dohnal |
74af86 |
@@ -448,7 +449,10 @@ static PyTypeObject* py3_PyType_Type;
|
|
Zdenek Dohnal |
74af86 |
static PyTypeObject* py3_PyStdPrinter_Type;
|
|
Zdenek Dohnal |
74af86 |
static PyTypeObject* py3_PySlice_Type;
|
|
Zdenek Dohnal |
74af86 |
static PyTypeObject* py3_PyFloat_Type;
|
|
Zdenek Dohnal |
74af86 |
-static PyTypeObject* py3_PyBool_Type;
|
|
Zdenek Dohnal |
74af86 |
+PyTypeObject* py3_PyBool_Type;
|
|
Zdenek Dohnal |
74af86 |
+# if PY_VERSION_HEX >= 0x030c00b0
|
|
Zdenek Dohnal |
74af86 |
+PyTypeObject* py3_PyLong_Type;
|
|
Zdenek Dohnal |
74af86 |
+# endif
|
|
Zdenek Dohnal |
74af86 |
static int (*py3_PyNumber_Check)(PyObject *);
|
|
Zdenek Dohnal |
74af86 |
static PyObject* (*py3_PyNumber_Long)(PyObject *);
|
|
Zdenek Dohnal |
74af86 |
static PyObject* (*py3_PyErr_NewException)(char *name, PyObject *base, PyObject *dict);
|
|
Zdenek Dohnal |
74af86 |
@@ -624,6 +628,9 @@ static struct
|
|
Zdenek Dohnal |
74af86 |
{"PySlice_Type", (PYTHON_PROC*)&py3_PySlice_Type},
|
|
Zdenek Dohnal |
74af86 |
{"PyFloat_Type", (PYTHON_PROC*)&py3_PyFloat_Type},
|
|
Zdenek Dohnal |
74af86 |
{"PyBool_Type", (PYTHON_PROC*)&py3_PyBool_Type},
|
|
Zdenek Dohnal |
74af86 |
+# if PY_VERSION_HEX >= 0x030c00b0
|
|
Zdenek Dohnal |
74af86 |
+ {"PyLong_Type", (PYTHON_PROC*)&py3_PyLong_Type},
|
|
Zdenek Dohnal |
74af86 |
+# endif
|
|
Zdenek Dohnal |
74af86 |
{"PyNumber_Check", (PYTHON_PROC*)&py3_PyNumber_Check},
|
|
Zdenek Dohnal |
74af86 |
{"PyNumber_Long", (PYTHON_PROC*)&py3_PyNumber_Long},
|
|
Zdenek Dohnal |
74af86 |
{"PyErr_NewException", (PYTHON_PROC*)&py3_PyErr_NewException},
|
|
Zdenek Dohnal |
74af86 |
--
|
|
Zdenek Dohnal |
74af86 |
2.41.0
|
|
Zdenek Dohnal |
74af86 |
|