Commit c31fd30c authored by gabrieldemarmiesse's avatar gabrieldemarmiesse

Merge branch 'master' into transfered_type_casting

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