mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Merge pull request #1756 from sgn/python-3.11
plugin: python: fix build for Python 3.11
This commit is contained in:
commit
7ffe55e980
@ -1619,8 +1619,16 @@ static char*
|
|||||||
_python_plugin_name(void)
|
_python_plugin_name(void)
|
||||||
{
|
{
|
||||||
PyThreadState* ts = PyThreadState_Get();
|
PyThreadState* ts = PyThreadState_Get();
|
||||||
|
#if PY_VERSION_HEX >= 0x030B0000
|
||||||
|
PyFrameObject* frame = PyThreadState_GetFrame(ts);
|
||||||
|
PyCodeObject* code = PyFrame_GetCode(frame);
|
||||||
|
char* filename = python_str_or_unicode_to_string(code->co_filename);
|
||||||
|
Py_DECREF(code);
|
||||||
|
Py_DECREF(frame);
|
||||||
|
#else
|
||||||
PyFrameObject* frame = ts->frame;
|
PyFrameObject* frame = ts->frame;
|
||||||
char* filename = python_str_or_unicode_to_string(frame->f_code->co_filename);
|
char* filename = python_str_or_unicode_to_string(frame->f_code->co_filename);
|
||||||
|
#endif
|
||||||
gchar** split = g_strsplit(filename, "/", 0);
|
gchar** split = g_strsplit(filename, "/", 0);
|
||||||
free(filename);
|
free(filename);
|
||||||
char* plugin_name = strdup(split[g_strv_length(split) - 1]);
|
char* plugin_name = strdup(split[g_strv_length(split) - 1]);
|
||||||
|
Loading…
Reference in New Issue
Block a user