Commit c31fd30c authored by gabrieldemarmiesse's avatar gabrieldemarmiesse

Merge branch 'master' into transfered_type_casting

parents 01fd4fe4 d171c28d
......@@ -80,7 +80,6 @@ matrix:
allow_failures:
- python: pypy
- python: pypy3
- python: 3.7-dev
exclude:
- python: pypy
env: BACKEND=cpp
......
......@@ -47,6 +47,8 @@ typedef struct {
static PyTypeObject *__pyx_CyFunctionType = 0;
#define __Pyx_CyFunction_Check(obj) (__Pyx_TypeCheck(obj, __pyx_CyFunctionType))
#define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, globals, code) \
__Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, globals, code)
......@@ -1255,7 +1257,7 @@ static PyObject* __Pyx_Method_ClassMethod(PyObject *method) {
return PyClassMethod_New(method);
}
#ifdef __Pyx_CyFunction_USED
else if (__Pyx_TypeCheck(method, __pyx_CyFunctionType)) {
else if (__Pyx_CyFunction_Check(method)) {
return PyClassMethod_New(method);
}
#endif
......
......@@ -338,10 +338,17 @@ static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
value = PyDict_GetItemWithError(d, key);
if (unlikely(!value)) {
if (!PyErr_Occurred()) {
if (unlikely(PyTuple_Check(key))) {
// CPython interprets tuples as separate arguments => must wrap them in another tuple.
PyObject* args = PyTuple_Pack(1, key);
if (likely(args))
if (likely(args)) {
PyErr_SetObject(PyExc_KeyError, args);
Py_XDECREF(args);
Py_DECREF(args);
}
} else {
// Avoid tuple packing if possible.
PyErr_SetObject(PyExc_KeyError, key);
}
}
return NULL;
}
......@@ -1432,12 +1439,13 @@ static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **me
descr = _PyType_Lookup(tp, name);
if (likely(descr != NULL)) {
Py_INCREF(descr);
if (likely(PyFunction_Check(descr)
#if PY_MAJOR_VERSION >= 3
if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type)))
#else
// "PyMethodDescr_Type" is not part of the C-API in Py2.
|| (Py_TYPE(descr) == &PyMethodDescr_Type)
if (likely(PyFunction_Check(descr)))
#endif
)) {
{
meth_found = 1;
} else {
f = Py_TYPE(descr)->tp_descr_get;
......@@ -2227,10 +2235,11 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
}
#endif
#ifdef __Pyx_CyFunction_USED
if (likely(PyCFunction_Check(func) || __Pyx_TypeCheck(func, __pyx_CyFunctionType))) {
if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
#else
if (likely(PyCFunction_Check(func))) {
if (likely(PyCFunction_Check(func)))
#endif
{
if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
// fast and simple case that we are optimising for
return __Pyx_PyObject_CallMethO(func, NULL);
......
......@@ -12,6 +12,8 @@ Language Basics
Cython File Types
=================
.. NOW IN USER GUIDE, DO NOT TOUCH
There are three file types in Cython:
* Implementation files carry a ``.pyx`` suffix
......
.. _pxd_files:
pxd files
=========
......
This diff is collapsed.
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