Changeset: c8b5a0a4e270 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/c8b5a0a4e270
Modified Files:
sql/backends/monet5/UDF/pyapi3/pyheader.h
sql/backends/monet5/UDF/pyapi3/type_conversion3.c
Branch: Jul2021
Log Message:
Minimal port to Python 3.11 (i.e. get it to compile).
We just disable the deprecation warnings when we include Python.h.
diffs (46 lines):
diff --git a/sql/backends/monet5/UDF/pyapi3/pyheader.h
b/sql/backends/monet5/UDF/pyapi3/pyheader.h
--- a/sql/backends/monet5/UDF/pyapi3/pyheader.h
+++ b/sql/backends/monet5/UDF/pyapi3/pyheader.h
@@ -34,6 +34,7 @@
#undef _GNU_SOURCE
#undef _XOPEN_SOURCE
#undef _POSIX_C_SOURCE
+#define __deprecated__
#ifdef _DEBUG
#undef _DEBUG
#include <Python.h>
@@ -41,6 +42,7 @@
#else
#include <Python.h>
#endif
+#undef __deprecated__
// Numpy Library
#ifdef __COVERITY__
diff --git a/sql/backends/monet5/UDF/pyapi3/type_conversion3.c
b/sql/backends/monet5/UDF/pyapi3/type_conversion3.c
--- a/sql/backends/monet5/UDF/pyapi3/type_conversion3.c
+++ b/sql/backends/monet5/UDF/pyapi3/type_conversion3.c
@@ -10,7 +10,11 @@
#include "type_conversion.h"
#include "unicode.h"
+#if PY_MINOR_VERSION >= 11
+#include <cpython/longintrepr.h>
+#else
#include <longintrepr.h>
+#endif
#define PyInt_Check PyLong_Check
#define PyString_CheckExact PyUnicode_CheckExact
@@ -55,7 +59,11 @@ PyObject *PyLong_FromHge(hge h)
z->ob_digit[i] = result;
}
if (h < 0)
+#ifdef Py_SET_SIZE
+ Py_SET_SIZE(z, -Py_SIZE(z));
+#else
Py_SIZE(z) = -(Py_SIZE(z));
+#endif
return (PyObject *)z;
}
#endif
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]