diff options
author | James Booth <boothj5@gmail.com> | 2016-07-18 23:24:26 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2016-07-18 23:24:26 +0100 |
commit | 71ccfcc09fed24bb3b9115efe3a827b862d366de (patch) | |
tree | c8a260bd7296112b65cb030e0452df5c02c48bf0 /src | |
parent | 269b8ce83225d98f683ff12f06847ea224788f06 (diff) | |
download | profani-tty-71ccfcc09fed24bb3b9115efe3a827b862d366de.tar.gz |
Add python_init_prof()
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/python_api.c | 14 | ||||
-rw-r--r-- | src/plugins/python_api.h | 4 | ||||
-rw-r--r-- | src/plugins/python_plugins.c | 11 |
3 files changed, 16 insertions, 13 deletions
diff --git a/src/plugins/python_api.c b/src/plugins/python_api.c index e0d54c1c..01f7f8bd 100644 --- a/src/plugins/python_api.c +++ b/src/plugins/python_api.c @@ -872,6 +872,20 @@ python_api_init(void) #endif } +void +python_init_prof(void) +{ +#if PY_MAJOR_VERSION >= 3 + PyImport_AppendInittab("prof", python_api_init); + Py_Initialize(); + PyEval_InitThreads(); +#else + Py_Initialize(); + PyEval_InitThreads(); + python_api_init(); +#endif +} + static char* _python_plugin_name(void) { diff --git a/src/plugins/python_api.h b/src/plugins/python_api.h index 339ac06b..79280cc6 100644 --- a/src/plugins/python_api.h +++ b/src/plugins/python_api.h @@ -35,10 +35,8 @@ #ifndef PYTHON_API_H #define PYTHON_API_H -#include <Python.h> - void python_env_init(void); -PyMODINIT_FUNC python_api_init(void); +void python_init_prof(void); void python_shutdown(void); void python_command_callback(PluginCommand *command, gchar **args); diff --git a/src/plugins/python_plugins.c b/src/plugins/python_plugins.c index 670dd46f..15e244e1 100644 --- a/src/plugins/python_plugins.c +++ b/src/plugins/python_plugins.c @@ -68,18 +68,9 @@ _unref_module(PyObject *module) void python_env_init(void) { - loaded_modules = g_hash_table_new_full(g_str_hash, g_str_equal, free, (GDestroyNotify)_unref_module); -#if PY_MAJOR_VERSION >= 3 - PyImport_AppendInittab("prof", python_api_init); - Py_Initialize(); - PyEval_InitThreads(); -#else - Py_Initialize(); - PyEval_InitThreads(); - python_api_init(); -#endif + python_init_prof(); const char *ver = Py_GetVersion(); cons_show("PYTHON: %s", ver); |