Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refine _PyObject_FastCallDict and PyObject_VectorcallDict usages #254

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions pydevd_attach_to_process/common/py_settrace.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,20 +127,20 @@ int InternalSetSysTraceFunc(
pyUnicode_InternFromString = stringFromString;
}

DEFINE_PROC_NO_CHECK(pyObject_FastCallDict, _PyObject_FastCallDict*, "_PyObject_FastCallDict", 530);
DEFINE_PROC(pyTuple_New, PyTuple_New*, "PyTuple_New", 531);
DEFINE_PROC(pyEval_CallObjectWithKeywords, PyEval_CallObjectWithKeywords*, "PyEval_CallObjectWithKeywords", 532);

if(pyObject_FastCallDict == nullptr) {
DEFINE_PROC_NO_CHECK(pyObject_VectorcallDict, _PyObject_FastCallDict*, "PyObject_VectorcallDict", 533);
pyObject_FastCallDict = pyObject_VectorcallDict;
}

if(pyObject_FastCallDict == nullptr) {
// we have to use PyObject_FastCallDictCustom for older versions of CPython (pre 3.7).
_PyObject_FastCallDict* pyObject_FastCallDict;
if (version < PythonVersion_37) {
pyObject_FastCallDict = reinterpret_cast<_PyObject_FastCallDict*>(&PyObject_FastCallDictCustom);
} else if (version < PythonVersion_39) {
DEFINE_PROC(fastCallDict, _PyObject_FastCallDict*, "_PyObject_FastCallDict", 530);
pyObject_FastCallDict = fastCallDict;
} else {
DEFINE_PROC(vectorcallDict, _PyObject_FastCallDict*, "PyObject_VectorcallDict", 530);
pyObject_FastCallDict = vectorcallDict;
}

DEFINE_PROC(pyTuple_New, PyTuple_New*, "PyTuple_New", 531);
DEFINE_PROC(pyEval_CallObjectWithKeywords, PyEval_CallObjectWithKeywords*, "PyEval_CallObjectWithKeywords", 532);


DEFINE_PROC(pyTraceBack_Here, PyTraceBack_Here*, "PyTraceBack_Here", 540);
DEFINE_PROC(pyEval_SetTrace, PyEval_SetTrace*, "PyEval_SetTrace", 550);
Expand Down