aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/pythoncore
diff options
context:
space:
mode:
authorGravatar wodim2017-08-26 15:02:56 +0200
committerGravatar wodim2017-08-26 15:02:56 +0200
commitdbe8ef6dad916124c3714abc469403ed9991261c (patch)
treebc5625e1bd114f6b428444481d5a5f8088daf2f1 /src/modules/pythoncore
parentremove blank part of the splash img (diff)
downloadKVIrc-dbe8ef6dad916124c3714abc469403ed9991261c.tar.gz
KVIrc-dbe8ef6dad916124c3714abc469403ed9991261c.tar.bz2
KVIrc-dbe8ef6dad916124c3714abc469403ed9991261c.zip
Add support for Python 3
Diffstat (limited to 'src/modules/pythoncore')
-rw-r--r--src/modules/pythoncore/kvircmodule.cpp2
-rw-r--r--src/modules/pythoncore/pythonheaderwrapper.h6
2 files changed, 7 insertions, 1 deletions
diff --git a/src/modules/pythoncore/kvircmodule.cpp b/src/modules/pythoncore/kvircmodule.cpp
index 8937b6a63..659345d7e 100644
--- a/src/modules/pythoncore/kvircmodule.cpp
+++ b/src/modules/pythoncore/kvircmodule.cpp
@@ -423,7 +423,7 @@ PyMODINIT_FUNC python_init()
else
{
// Create a CObject containing the API pointer array's address
- PyObject * pC_API_Object = PyCObject_FromVoidPtr(PyKVIrc_API, nullptr);
+ PyObject * pC_API_Object = PyCapsule_New((void *)PyKVIrc_API, "kvirc._C_API", nullptr);
if(pC_API_Object)
PyModule_AddObject(pModule, "_C_API", pC_API_Object);
}
diff --git a/src/modules/pythoncore/pythonheaderwrapper.h b/src/modules/pythoncore/pythonheaderwrapper.h
index 47f60d361..2b34066c3 100644
--- a/src/modules/pythoncore/pythonheaderwrapper.h
+++ b/src/modules/pythoncore/pythonheaderwrapper.h
@@ -1,6 +1,12 @@
#ifndef _PYTHONHEADERWRAPPER_H_
#define _PYTHONHEADERWRAPPER_H_
+// As of Python 3, something inside <Python.h> defines a struct with a member
+// called "slots" which conflicts with the builtin Qt keyword. But since we
+// include stuff from KVIrc itself back into the python module, we can't just
+// use QT_NO_KEYWORDS.
+#undef slots
+
// See http://stackoverflow.com/questions/16200997/why-doesnt-include-python-h-work and http://stackoverflow.com/questions/19716859/puzzling-dependency-of-boost-python-1-54-debug-build-to-python27-lib-on-window
#if defined(_DEBUG) && defined(_MSC_VER)