mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 00:36:51 +00:00
gst-python: gstmodule.c: fix build with 3.11
https://docs.python.org/fr/3.10/whatsnew/3.10.html Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1639>
This commit is contained in:
parent
568b918971
commit
b6ffad41ca
1 changed files with 18 additions and 3 deletions
|
@ -685,22 +685,37 @@ pygst_debug_log (PyObject * pyobject, PyObject * string, GstDebugLevel level,
|
|||
|
||||
frame = PyEval_GetFrame ();
|
||||
{
|
||||
#if PY_VERSION_HEX < 0x030a0000
|
||||
PyCodeObject *code = frame->f_code;
|
||||
#else
|
||||
PyCodeObject *code = PyFrame_GetCode (frame);
|
||||
#endif
|
||||
PyObject *utf8;
|
||||
const gchar *utf8_str;
|
||||
|
||||
utf8 = PyUnicode_AsUTF8String (frame->f_code->co_name);
|
||||
utf8 = PyUnicode_AsUTF8String (code->co_name);
|
||||
utf8_str = PyBytes_AS_STRING (utf8);
|
||||
|
||||
function = g_strdup (utf8_str);
|
||||
Py_DECREF (utf8);
|
||||
|
||||
utf8 = PyUnicode_AsUTF8String (frame->f_code->co_filename);
|
||||
utf8 = PyUnicode_AsUTF8String (code->co_filename);
|
||||
utf8_str = PyBytes_AS_STRING (utf8);
|
||||
|
||||
filename = g_strdup (utf8_str);
|
||||
Py_DECREF (utf8);
|
||||
#if PY_VERSION_HEX < 0x030a0000
|
||||
lineno = PyCode_Addr2Line (frame->f_code, frame->f_lasti);
|
||||
#else
|
||||
lineno = PyFrame_GetLineNumber (frame);
|
||||
#endif
|
||||
|
||||
#if PY_VERSION_HEX >= 0x030a0000
|
||||
Py_DECREF (code);
|
||||
#endif
|
||||
}
|
||||
lineno = PyCode_Addr2Line (frame->f_code, frame->f_lasti);
|
||||
|
||||
|
||||
/* gst_debug_log : category, level, file, function, line, object, format, va_list */
|
||||
if (isgstobject)
|
||||
object = G_OBJECT (pygobject_get (pyobject));
|
||||
|
|
Loading…
Reference in a new issue