Commit f284a303 authored by scoder's avatar scoder Committed by GitHub

Merge branch 'master' into keyword_only_arguments

parents e554cc85 dc0f623a
...@@ -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()) {
if (unlikely(PyTuple_Check(key))) {
// CPython interprets tuples as separate arguments => must wrap them in another tuple.
PyObject* args = PyTuple_Pack(1, key); PyObject* args = PyTuple_Pack(1, key);
if (likely(args)) if (likely(args)) {
PyErr_SetObject(PyExc_KeyError, 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; 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
if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type)))
#else
// "PyMethodDescr_Type" is not part of the C-API in Py2. // "PyMethodDescr_Type" is not part of the C-API in Py2.
|| (Py_TYPE(descr) == &PyMethodDescr_Type) 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