Commit bbb832bc authored by Robert Bradshaw's avatar Robert Bradshaw

merge

parents b4c2c4c2 a16d61b9
...@@ -836,8 +836,11 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -836,8 +836,11 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
#if need_self_cast: #if need_self_cast:
# self.generate_self_cast(scope, code) # self.generate_self_cast(scope, code)
if type.vtabslot_cname: if type.vtabslot_cname:
if base_type: vtab_base_type = type
struct_type_cast = "(struct %s*)" % base_type.vtabstruct_cname 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: else:
struct_type_cast = "" struct_type_cast = ""
code.putln("p->%s = %s%s;" % ( code.putln("p->%s = %s%s;" % (
......
...@@ -2,6 +2,7 @@ PYTHON?=python ...@@ -2,6 +2,7 @@ PYTHON?=python
clean: clean:
@echo Cleaning Source @echo Cleaning Source
@rm -fr build
@rm -f *.pyc */*.pyc */*/*.pyc @rm -f *.pyc */*.pyc */*/*.pyc
@rm -f *~ */*~ */*/*~ @rm -f *~ */*~ */*/*~
@rm -f core */core @rm -f core */core
......
...@@ -287,7 +287,18 @@ def collect_unittests(path, suite, selectors): ...@@ -287,7 +287,18 @@ def collect_unittests(path, suite, selectors):
loader = unittest.TestLoader() loader = unittest.TestLoader()
skipped_dirs = []
for dirpath, dirnames, filenames in os.walk(path): 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] parentname = os.path.split(dirpath)[-1]
if package_matches(parentname): if package_matches(parentname):
for f in filenames: for f in filenames:
......
...@@ -14,8 +14,8 @@ if sys.version_info < (2,4): ...@@ -14,8 +14,8 @@ if sys.version_info < (2,4):
cython_dir = os.path.join(get_python_lib(prefix=''), 'Cython') cython_dir = os.path.join(get_python_lib(prefix=''), 'Cython')
compiler_dir = os.path.join(cython_dir, 'Compiler') compiler_dir = os.path.join(cython_dir, 'Compiler')
setup_args['data_files'] = [ setup_args['data_files'] = [
{compiler_dir : ['Cython/Compiler/Lexicon.pickle'], (compiler_dir, ['Cython/Compiler/Lexicon.pickle']),
cython_dir : ['Cython/Includes/*.pxd']}] (cython_dir, ['Cython/Includes/*.pxd'])]
else: else:
setup_args['package_data'] = {'Cython.Compiler' : ['Lexicon.pickle'], setup_args['package_data'] = {'Cython.Compiler' : ['Lexicon.pickle'],
'Cython' : ['Includes/*.pxd']} 'Cython' : ['Includes/*.pxd']}
......
__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()
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