1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-06 23:05:43 +02:00

python: support of Python 3.x (task #11704)

Note that Python 2.x is still the only Python compiled if found:
Python 3.x is not auto-detected by cmake neither configure.
Many official Python scripts will not load/run with Python 3.x,
so Python 2.x (2.7 or 2.6) is still the recommended version.
This commit is contained in:
Sebastien Helleu
2012-01-03 19:35:05 +01:00
parent e9baa5910c
commit daea95866c
5 changed files with 236 additions and 104 deletions
@@ -50,8 +50,8 @@
python_function_name); \
__ret; \
}
#define API_RETURN_OK return Py_BuildValue ("i", 1);
#define API_RETURN_ERROR return Py_BuildValue ("i", 0);
#define API_RETURN_OK return PyLong_FromLong((long)1);
#define API_RETURN_ERROR return PyLong_FromLong ((long)0);
#define API_RETURN_EMPTY \
Py_INCREF (Py_None); \
return Py_None;
@@ -68,9 +68,9 @@
} \
return Py_BuildValue ("s", "")
#define API_RETURN_INT(__int) \
return Py_BuildValue ("i", __int);
return PyLong_FromLong((long)__int);
#define API_RETURN_LONG(__long) \
return Py_BuildValue ("l", __long);
return PyLong_FromLong(__long);
#define API_DEF_FUNC(__name) \
{ #__name, &weechat_python_api_##__name, METH_VARARGS, "" }
File diff suppressed because it is too large Load Diff
@@ -26,6 +26,14 @@
#define PYTHON_CURRENT_SCRIPT_NAME ((python_current_script) ? python_current_script->name : "-")
/* define some bytes functions for old python (<= 2.5) */
#if PY_VERSION_HEX < 0x02060000
#define PyBytes_AsString PyString_AsString
#define PyBytes_Check PyString_Check
#define PyBytes_FromString PyString_FromString
#define PyUnicode_FromString PyString_FromString
#endif
extern struct t_weechat_plugin *weechat_python_plugin;
extern int python_quiet;