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
bbb832bc
Commit
bbb832bc
authored
Jul 31, 2008
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
b4c2c4c2
a16d61b9
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
75 additions
and
4 deletions
+75
-4
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+5
-2
Makefile
Makefile
+1
-0
runtests.py
runtests.py
+11
-0
setup.py
setup.py
+2
-2
tests/run/subclasses.pyx
tests/run/subclasses.pyx
+56
-0
No files found.
Cython/Compiler/ModuleNode.py
View file @
bbb832bc
...
...
@@ -836,8 +836,11 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
#if need_self_cast:
# self.generate_self_cast(scope, code)
if
type
.
vtabslot_cname
:
if
base_type
:
struct_type_cast
=
"(struct %s*)"
%
base_type
.
vtabstruct_cname
vtab_base_type
=
type
while
vtab_base_type
.
base_type
and
vtab_base_type
.
base_type
.
vtabstruct_cname
:
vtab_base_type
=
vtab_base_type
.
base_type
if
vtab_base_type
is
not
type
:
struct_type_cast
=
"(struct %s*)"
%
vtab_base_type
.
vtabstruct_cname
else
:
struct_type_cast
=
""
code
.
putln
(
"p->%s = %s%s;"
%
(
...
...
Makefile
View file @
bbb832bc
...
...
@@ -2,6 +2,7 @@ PYTHON?=python
clean
:
@
echo
Cleaning Source
@
rm
-fr
build
@
rm
-f
*
.pyc
*
/
*
.pyc
*
/
*
/
*
.pyc
@
rm
-f
*
~
*
/
*
~
*
/
*
/
*
~
@
rm
-f
core
*
/core
...
...
runtests.py
View file @
bbb832bc
...
...
@@ -287,7 +287,18 @@ def collect_unittests(path, suite, selectors):
loader
=
unittest
.
TestLoader
()
skipped_dirs
=
[]
for
dirpath
,
dirnames
,
filenames
in
os
.
walk
(
path
):
if
dirpath
!=
path
and
"__init__.py"
not
in
filenames
:
skipped_dirs
.
append
(
dirpath
+
os
.
path
.
sep
)
continue
skip
=
False
for
dir
in
skipped_dirs
:
if
dirpath
.
startswith
(
dir
):
skip
=
True
if
skip
:
continue
parentname
=
os
.
path
.
split
(
dirpath
)[
-
1
]
if
package_matches
(
parentname
):
for
f
in
filenames
:
...
...
setup.py
View file @
bbb832bc
...
...
@@ -14,8 +14,8 @@ if sys.version_info < (2,4):
cython_dir
=
os
.
path
.
join
(
get_python_lib
(
prefix
=
''
),
'Cython'
)
compiler_dir
=
os
.
path
.
join
(
cython_dir
,
'Compiler'
)
setup_args
[
'data_files'
]
=
[
{
compiler_dir
:
[
'Cython/Compiler/Lexicon.pickle'
]
,
cython_dir
:
[
'Cython/Includes/*.pxd'
]}
]
(
compiler_dir
,
[
'Cython/Compiler/Lexicon.pickle'
])
,
(
cython_dir
,
[
'Cython/Includes/*.pxd'
])
]
else
:
setup_args
[
'package_data'
]
=
{
'Cython.Compiler'
:
[
'Lexicon.pickle'
],
'Cython'
:
[
'Includes/*.pxd'
]}
...
...
tests/run/subclasses.pyx
0 → 100644
View file @
bbb832bc
__doc__
=
u"""
>>> zoo = Zoo()
>>> for cl in (Zoo, Bam, Bar, Foo, Base, Base0): assert isinstance(zoo, cl)
>>> fooit(zoo)
42
>>> bam = Bam()
>>> for cl in (Bam, Bar, Foo, Base, Base0): assert isinstance(bam, cl)
>>> fooit(bam)
42
>>> bar = Bar()
>>> for cl in (Bar, Foo, Base, Base0): assert isinstance(bar, cl)
>>> fooit(bar)
42
>>> foo = Foo()
>>> for cl in (Foo, Base, Base0): assert isinstance(foo, cl)
>>> fooit(foo)
42
>>> base = Base()
>>> for cl in (Base, Base0): assert isinstance(base, cl)
>>> fooit(base)
Traceback (most recent call last):
TypeError: Argument 'foo' has incorrect type (expected subclasses.Foo, got subclasses.Base)
>>> base0 = Base0()
>>> for cl in (Base0,): assert isinstance(base0, cl)
>>> fooit(base0)
Traceback (most recent call last):
TypeError: Argument 'foo' has incorrect type (expected subclasses.Foo, got subclasses.Base0)
"""
cdef
class
Base0
:
pass
cdef
class
Base
(
Base0
):
pass
cdef
class
Foo
(
Base
):
cdef
fooit
(
self
):
return
42
cdef
class
Bar
(
Foo
):
pass
cdef
class
Bam
(
Bar
):
pass
cdef
class
Zoo
(
Bam
):
pass
def
fooit
(
Foo
foo
):
return
foo
.
fooit
()
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