Commit d171c28d authored by Stefan Behnel's avatar Stefan Behnel

Fix utility function in MSVC which does not support C preprocessor tests...

Fix utility function in MSVC which does not support C preprocessor tests inside of macro expansions ("likely()").
parent d5b686b6
...@@ -1439,12 +1439,13 @@ static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **me ...@@ -1439,12 +1439,13 @@ static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **me
descr = _PyType_Lookup(tp, name); descr = _PyType_Lookup(tp, name);
if (likely(descr != NULL)) { if (likely(descr != NULL)) {
Py_INCREF(descr); Py_INCREF(descr);
if (likely(PyFunction_Check(descr)
#if PY_MAJOR_VERSION >= 3 #if PY_MAJOR_VERSION >= 3
// "PyMethodDescr_Type" is not part of the C-API in Py2. if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type)))
|| (Py_TYPE(descr) == &PyMethodDescr_Type) #else
// "PyMethodDescr_Type" is not part of the C-API in Py2.
if (likely(PyFunction_Check(descr)))
#endif #endif
)) { {
meth_found = 1; meth_found = 1;
} else { } else {
f = Py_TYPE(descr)->tp_descr_get; f = Py_TYPE(descr)->tp_descr_get;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment