From 51895be43ae91c81fa70faad0d4a49e401cd8e0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?= Date: Thu, 22 Sep 2022 21:47:35 +0700 Subject: [PATCH] profanity: fix build with Python 3.11 --- srcpkgs/profanity/patches/python-3.11.patch | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 srcpkgs/profanity/patches/python-3.11.patch diff --git a/srcpkgs/profanity/patches/python-3.11.patch b/srcpkgs/profanity/patches/python-3.11.patch new file mode 100644 index 00000000000..6afe49dc2a7 --- /dev/null +++ b/srcpkgs/profanity/patches/python-3.11.patch @@ -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]);