Commit 6a587681 authored by Robert Bradshaw's avatar Robert Bradshaw

merge

parents 09556243 fe9f7400
......@@ -6,7 +6,7 @@ include setup.py
include bin/cython
include cython.py
include Cython/Compiler/Lexicon.pickle
include Cython/Includes/*.pxd
recursive-include Cython *.pyx *.pxd
include Doc/*
include Demos/*.pyx
......
__doc__ = u"""
>>> global_c_and_s()
99
abcdef
>>> local_c_and_s()
98
bcdefg
"""
cdef char c = 'c'
cdef char* s = 'abcdef'
def global_c_and_s():
pys = s
print c
print pys.decode('ASCII')
def local_c_and_s():
cdef char c = 'b'
cdef char* s = 'bcdefg'
pys = s
print c
print pys.decode('ASCII')
__doc__ = u"""
>>> f = PyFoo()
>>> print(f.bar)
5
>>> print(f.baz)
someval
>>> f = MyPyFoo()
>>> print(f.bar)
7
>>> print(f.baz)
anotherval
>>> f = CyFoo()
>>> print(f.bar)
5
>>> print(f.baz)
anotherval
>>> f = MyCyFoo()
>>> print(f.bar)
7
>>> print(f.baz)
anotherval
>>> f = AnotherFoo()
>>> print(f.bar)
8
>>> print(f.baz)
yetanotherval
"""
# this works:
class PyFoo(object):
bar = 5
baz = u"someval"
class MyPyFoo(PyFoo):
bar = 7
baz = u"anotherval"
# this doesn't:
cdef class CyFoo:
cdef public int bar = 5
cdef public object baz = u"someval"
cdef class MyCyFoo(CyFoo):
cdef public int bar = 7
cdef public object baz = u"anotherval"
class AnotherFoo(CyFoo):
bar = 8
baz = u"yetanotherval"
cdef class A:
cpdef a(int not_self):
pass
......@@ -44,6 +44,11 @@ __doc__ = u"""
-inf
>>> float_infn == float('-inf')
True
>>> global_floats()[1:] == (float('+inf'), float('-inf'))
True
>>> global_floats()[0]
nan
"""
DEF FLOAT = 12.5
......@@ -51,6 +56,10 @@ DEF FLOAT_NAN = float('nan')
DEF FLOAT_INFP = float('+inf')
DEF FLOAT_INFN = float('-inf')
cdef double cdef_float_nan = float('nan')
cdef double cdef_float_infp = float('+inf')
cdef double cdef_float_infn = float('-inf')
float_nan = FLOAT_NAN
float_infp = FLOAT_INFP
float_infn = FLOAT_INFN
......@@ -105,3 +114,5 @@ def infn3():
f = FLOAT_INFN
return f
def global_floats():
return (cdef_float_nan, cdef_float_infp, cdef_float_infn)
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