Commit 6f637eff authored by Stefan Behnel's avatar Stefan Behnel

extended closure test case, more bug analysis

parent 30a0e717
...@@ -6,6 +6,10 @@ __doc__ = u""" ...@@ -6,6 +6,10 @@ __doc__ = u"""
>>> a(5)() >>> a(5)()
8 8
>>> local_x(1)(2)(4)
4 2 1
15
# this currently segfaults: # this currently segfaults:
#>>> x(1)(2)(4) #>>> x(1)(2)(4)
#15 #15
...@@ -36,6 +40,7 @@ __doc__ = u""" ...@@ -36,6 +40,7 @@ __doc__ = u"""
#True #True
>>> inner_funcs = more_inner_funcs(1)(2,4,8) >>> inner_funcs = more_inner_funcs(1)(2,4,8)
# this currently segfaults: # this currently segfaults:
#>>> inner_funcs[0](16), inner_funcs[1](32), inner_funcs[2](64) #>>> inner_funcs[0](16), inner_funcs[1](32), inner_funcs[2](64)
...@@ -53,15 +58,26 @@ def a(int x): ...@@ -53,15 +58,26 @@ def a(int x):
return c() return c()
return b return b
def local_x(int arg_x):
def x(int x): cdef int local_x = arg_x
# currently segfaults def y(arg_y):
def y(y): y = arg_y
def z(long z): def z(long arg_z):
return 8+z+y+x cdef long z = arg_z
print z, y, local_x
return 8+z+y+local_x
return z return z
return y return y
# currently crashes Cython due to name redefinitions (see local_x())
## def x(int x):
## # currently segfaults
## def y(y):
## def z(long z):
## return 8+z+y+x
## return z
## return y
def inner_override(a,b): def inner_override(a,b):
def f(): def f():
...@@ -90,7 +106,7 @@ def reassign_int_int(int x): ...@@ -90,7 +106,7 @@ def reassign_int_int(int x):
def cy_twofuncs(x): def cy_twofuncs(x):
# pretty ugly segfault in PyEval_EvalFrameEx() *after* calling cy_twofuncs() ! # currently segfaults: adding NULL pointers
def f(a): def f(a):
return g(x) + a return g(x) + a
def g(b): def g(b):
......
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