bpo-34126: fix crashes while profiling certain invalid calls by jdemeyer · Pull Request #8300 · python/cpython

@jdemeyer

@jdemeyer jdemeyer changed the title bpo-34126: fix crashes while profiling invalid calls bpo-34126: fix crashes while profiling certain invalid calls

Jul 16, 2018

@jdemeyer

serhiy-storchaka

// We need to create PyCFunctionObject for tracing.
PyMethodDescrObject *descr = (PyMethodDescrObject*)func;
func = PyCFunction_NewEx(descr->d_method, stack[0], NULL);
if (nargs > 0 && tstate->use_tracing) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the check for tstate->c_profilefunc is missed?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That check is actually redundant. The old code was checking tstate->use_tracing && tstate->c_profilefunc twice (once here and once in the C_TRACE macro). It's not wrong to keep the additional tstate->c_profilefunc check but it's just not needed.

serhiy-storchaka

@miss-islington

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request

Jul 21, 2018
(cherry picked from commit 56868f9)

Co-authored-by: jdemeyer <jdemeyer@cage.ugent.be>

@bedevere-bot

serhiy-storchaka pushed a commit that referenced this pull request

Jul 21, 2018
)

(cherry picked from commit 56868f9)

Co-authored-by: jdemeyer <jdemeyer@cage.ugent.be>