profanity: fix build with Python 3.11
This commit is contained in:
parent
7680aa3289
commit
51895be43a
1 changed files with 17 additions and 0 deletions
17
srcpkgs/profanity/patches/python-3.11.patch
Normal file
17
srcpkgs/profanity/patches/python-3.11.patch
Normal file
|
@ -0,0 +1,17 @@
|
|||
--- a/src/plugins/python_api.c
|
||||
+++ b/src/plugins/python_api.c
|
||||
@@ -1619,8 +1619,14 @@ static char*
|
||||
_python_plugin_name(void)
|
||||
{
|
||||
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);
|
||||
+#else
|
||||
PyFrameObject* frame = ts->frame;
|
||||
char* filename = python_str_or_unicode_to_string(frame->f_code->co_filename);
|
||||
+#endif
|
||||
gchar** split = g_strsplit(filename, "/", 0);
|
||||
free(filename);
|
||||
char* plugin_name = strdup(split[g_strv_length(split) - 1]);
|
Loading…
Add table
Reference in a new issue