mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-25 05:06:22 +00:00
Add python_init_prof()
This commit is contained in:
@@ -872,6 +872,20 @@ python_api_init(void)
|
|||||||
#endif
|
#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*
|
static char*
|
||||||
_python_plugin_name(void)
|
_python_plugin_name(void)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -35,10 +35,8 @@
|
|||||||
#ifndef PYTHON_API_H
|
#ifndef PYTHON_API_H
|
||||||
#define PYTHON_API_H
|
#define PYTHON_API_H
|
||||||
|
|
||||||
#include <Python.h>
|
|
||||||
|
|
||||||
void python_env_init(void);
|
void python_env_init(void);
|
||||||
PyMODINIT_FUNC python_api_init(void);
|
void python_init_prof(void);
|
||||||
void python_shutdown(void);
|
void python_shutdown(void);
|
||||||
|
|
||||||
void python_command_callback(PluginCommand *command, gchar **args);
|
void python_command_callback(PluginCommand *command, gchar **args);
|
||||||
|
|||||||
@@ -68,18 +68,9 @@ _unref_module(PyObject *module)
|
|||||||
void
|
void
|
||||||
python_env_init(void)
|
python_env_init(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
loaded_modules = g_hash_table_new_full(g_str_hash, g_str_equal, free, (GDestroyNotify)_unref_module);
|
loaded_modules = g_hash_table_new_full(g_str_hash, g_str_equal, free, (GDestroyNotify)_unref_module);
|
||||||
|
|
||||||
#if PY_MAJOR_VERSION >= 3
|
python_init_prof();
|
||||||
PyImport_AppendInittab("prof", python_api_init);
|
|
||||||
Py_Initialize();
|
|
||||||
PyEval_InitThreads();
|
|
||||||
#else
|
|
||||||
Py_Initialize();
|
|
||||||
PyEval_InitThreads();
|
|
||||||
python_api_init();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const char *ver = Py_GetVersion();
|
const char *ver = Py_GetVersion();
|
||||||
cons_show("PYTHON: %s", ver);
|
cons_show("PYTHON: %s", ver);
|
||||||
|
|||||||
Reference in New Issue
Block a user