aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/Python/legacy_tracing.c
diff options
context:
space:
mode:
authorAlexSm <alex@ydb.tech>2024-08-19 16:16:30 +0200
committerGitHub <noreply@github.com>2024-08-19 17:16:30 +0300
commit9b567afd3339f4525feab53873592cb025b14251 (patch)
tree5c8489f98dc5a9a10f66065055e5a401bbd14767 /contrib/tools/python3/Python/legacy_tracing.c
parent47bd121575c210d4bbb2dddcc2131759a694df05 (diff)
downloadydb-9b567afd3339f4525feab53873592cb025b14251.tar.gz
Library import 240819-0942 (#7994)
Co-authored-by: robot-piglet <robot-piglet@yandex-team.com> Co-authored-by: hiddenpath <hiddenpath@yandex-team.com> Co-authored-by: bulatman <bulatman@yandex-team.com> Co-authored-by: robot-contrib <robot-contrib@yandex-team.com> Co-authored-by: osidorkin <osidorkin@yandex-team.com> Co-authored-by: akhropov <akhropov@yandex-team.com> Co-authored-by: akozhikhov <akozhikhov@yandex-team.com> Co-authored-by: orlovorlov <orlovorlov@yandex-team.com> Co-authored-by: babenko <babenko@yandex-team.com> Co-authored-by: shadchin <shadchin@yandex-team.com> Co-authored-by: dmasloff <dmasloff@yandex-team.com> Co-authored-by: aleksei-le <aleksei-le@yandex-team.com> Co-authored-by: coteeq <coteeq@yandex-team.com> Co-authored-by: dimdim11 <dimdim11@yandex-team.com> Co-authored-by: robot-ya-builder <robot-ya-builder@yandex-team.com> Co-authored-by: iaz1607 <iaz1607@yandex-team.com>
Diffstat (limited to 'contrib/tools/python3/Python/legacy_tracing.c')
-rw-r--r--contrib/tools/python3/Python/legacy_tracing.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/contrib/tools/python3/Python/legacy_tracing.c b/contrib/tools/python3/Python/legacy_tracing.c
index 43fa5910ef..4a6565bebc 100644
--- a/contrib/tools/python3/Python/legacy_tracing.c
+++ b/contrib/tools/python3/Python/legacy_tracing.c
@@ -103,6 +103,19 @@ sys_profile_call_or_return(
Py_DECREF(meth);
return res;
}
+ else if (Py_TYPE(callable) == &PyMethod_Type) {
+ // CALL instruction will grab the function from the method,
+ // so if the function is a C function, the return event will
+ // be emitted. However, CALL event happens before CALL
+ // instruction, so we need to handle this case here.
+ PyObject* func = PyMethod_GET_FUNCTION(callable);
+ if (func == NULL) {
+ return NULL;
+ }
+ if (PyCFunction_Check(func)) {
+ return call_profile_func(self, func);
+ }
+ }
Py_RETURN_NONE;
}