Mathieu Duponchelle 2022-02-04 15:53:45 +01:00 committed by GStreamer Marge Bot
parent 568b918971
commit b6ffad41ca

View file

@ -685,22 +685,37 @@ pygst_debug_log (PyObject * pyobject, PyObject * string, GstDebugLevel level,
frame = PyEval_GetFrame (); frame = PyEval_GetFrame ();
{ {
#if PY_VERSION_HEX < 0x030a0000
PyCodeObject *code = frame->f_code;
#else
PyCodeObject *code = PyFrame_GetCode (frame);
#endif
PyObject *utf8; PyObject *utf8;
const gchar *utf8_str; const gchar *utf8_str;
utf8 = PyUnicode_AsUTF8String (frame->f_code->co_name); utf8 = PyUnicode_AsUTF8String (code->co_name);
utf8_str = PyBytes_AS_STRING (utf8); utf8_str = PyBytes_AS_STRING (utf8);
function = g_strdup (utf8_str); function = g_strdup (utf8_str);
Py_DECREF (utf8); Py_DECREF (utf8);
utf8 = PyUnicode_AsUTF8String (frame->f_code->co_filename); utf8 = PyUnicode_AsUTF8String (code->co_filename);
utf8_str = PyBytes_AS_STRING (utf8); utf8_str = PyBytes_AS_STRING (utf8);
filename = g_strdup (utf8_str); filename = g_strdup (utf8_str);
Py_DECREF (utf8); Py_DECREF (utf8);
} #if PY_VERSION_HEX < 0x030a0000
lineno = PyCode_Addr2Line (frame->f_code, frame->f_lasti); lineno = PyCode_Addr2Line (frame->f_code, frame->f_lasti);
#else
lineno = PyFrame_GetLineNumber (frame);
#endif
#if PY_VERSION_HEX >= 0x030a0000
Py_DECREF (code);
#endif
}
/* gst_debug_log : category, level, file, function, line, object, format, va_list */ /* gst_debug_log : category, level, file, function, line, object, format, va_list */
if (isgstobject) if (isgstobject)
object = G_OBJECT (pygobject_get (pyobject)); object = G_OBJECT (pygobject_get (pyobject));