Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
7be2f7ab
Commit
7be2f7ab
authored
Jul 06, 2013
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Plain Diff
merge 0.19.x branch into master
parents
02189e8a
c3590cc4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
3 deletions
+58
-3
Cython/Utility/Builtins.c
Cython/Utility/Builtins.c
+6
-3
tests/run/builtin_subtype_methods_cy3.pyx
tests/run/builtin_subtype_methods_cy3.pyx
+52
-0
No files found.
Cython/Utility/Builtins.c
View file @
7be2f7ab
...
@@ -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
...
...
tests/run/builtin_subtype_methods_cy3.pyx
0 → 100644
View file @
7be2f7ab
# 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
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment