Commit 7be2f7ab authored by Stefan Behnel's avatar Stefan Behnel

merge 0.19.x branch into master

parents 02189e8a c3590cc4
...@@ -273,10 +273,11 @@ static CYTHON_INLINE PyObject* __Pyx_PyDict_Keys(PyObject* d); /*proto*/ ...@@ -273,10 +273,11 @@ static CYTHON_INLINE PyObject* __Pyx_PyDict_Keys(PyObject* d); /*proto*/
#endif #endif
//////////////////// py_dict_keys //////////////////// //////////////////// py_dict_keys ////////////////////
//@requires: ObjectHandling.c::PyObjectCallMethod
#if PY_MAJOR_VERSION >= 3 #if PY_MAJOR_VERSION >= 3
static CYTHON_INLINE PyObject* __Pyx_PyDict_Keys(PyObject* d) { static CYTHON_INLINE PyObject* __Pyx_PyDict_Keys(PyObject* d) {
return PyObject_CallMethodObjArgs(d, PYIDENT("keys"), NULL); return __Pyx_PyObject_CallMethod1((PyObject*)&PyDict_Type, PYIDENT("keys"), d);
} }
#endif #endif
...@@ -289,10 +290,11 @@ static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d); /*proto*/ ...@@ -289,10 +290,11 @@ static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d); /*proto*/
#endif #endif
//////////////////// py_dict_values //////////////////// //////////////////// py_dict_values ////////////////////
//@requires: ObjectHandling.c::PyObjectCallMethod
#if PY_MAJOR_VERSION >= 3 #if PY_MAJOR_VERSION >= 3
static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d) { static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d) {
return PyObject_CallMethodObjArgs(d, PYIDENT("values"), NULL); return __Pyx_PyObject_CallMethod1((PyObject*)&PyDict_Type, PYIDENT("values"), d);
} }
#endif #endif
...@@ -305,10 +307,11 @@ static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d); /*proto*/ ...@@ -305,10 +307,11 @@ static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d); /*proto*/
#endif #endif
//////////////////// py_dict_items //////////////////// //////////////////// py_dict_items ////////////////////
//@requires: ObjectHandling.c::PyObjectCallMethod
#if PY_MAJOR_VERSION >= 3 #if PY_MAJOR_VERSION >= 3
static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d) { static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d) {
return PyObject_CallMethodObjArgs(d, PYIDENT("items"), NULL); return __Pyx_PyObject_CallMethod1((PyObject*)&PyDict_Type, PYIDENT("items"), d);
} }
#endif #endif
......
# cython: language_level=3
# mode: run
# ticket: 653
class DictPySubtype(dict):
def keys(self):
"""
>>> d = DictPySubtype(one=42, two=17, three=0)
>>> for v in sorted(d.keys()):
... print(v)
three
two
"""
for key in dict.keys(self):
if key != 'one':
yield key
def values(self):
"""
>>> d = DictPySubtype(one=42, two=17, three=0)
>>> for v in sorted(d.values()):
... print(v)
17
42
"""
for value in dict.values(self):
if value:
yield value
def items(self):
"""
>>> d = DictPySubtype(one=42, two=17, three=0)
>>> for v in sorted(d.items()):
... print(v)
one
two
"""
for key, value in dict.items(self):
if value:
yield key
class ListPySubtype(list):
"""
>>> lst = ListPySubtype([1,2,3])
>>> lst.append(4)
>>> lst
[1, 2, 3, 5]
"""
def append(self, value):
list.append(self, value+1)
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