Commit 70571ff4 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Working on this

parent 03e6d17c
......@@ -15,7 +15,7 @@ Unless specified, arguments are borrowed and return values are owned. This can
Exception safety
Helpers:
AUTO_DECREF, autoDecref, incref
AUTO_DECREF, autoDecref, incref. DecrefHandle
Invariant: all paths through a function should leave each variable with 0 net refs. (This includes paths out via exceptions.)
......
......@@ -2,6 +2,10 @@ handle SIGUSR2 pass nostop noprint
skip file /usr/include/c++/4.8/bits/stl_vector.h
skip file /usr/include/c++/4.9/bits/stl_vector.h
skip file /usr/include/c++/4.8/bits/unique_ptr.h
skip file /usr/include/c++/4.9/bits/unique_ptr.h
skip file /usr/include/c++/4.8/bits/move.h
skip file /usr/include/c++/4.9/bits/move.h
skip pyston::ArgPassSpec::ArgPassSpec(int, int, bool, bool)
skip pyston::InternedString::getBox() const
......
......@@ -24,16 +24,20 @@ def make_closure(f):
return r
return inner
# The standard case, when the function is obtained via standard evaluation rules:
class C(object):
@make_closure
def f(self, other_arg=2.5**10):
print "f"
print other_arg
del C.f
print other_arg
c = C()
c.f()
def f():
# The standard case, when the function is obtained via standard evaluation rules:
class C(object):
@make_closure
def f(self, other_arg=2.5**10):
print "f"
print other_arg
del C.f
print other_arg
c = C()
c.f()
f()
f()
f()
def f():
class C(object):
......@@ -53,6 +57,7 @@ def f():
print e
f()
f()
f()
def f():
class C(object):
......@@ -73,6 +78,7 @@ def f():
print e
f()
f()
f()
def f():
class C(object):
......@@ -92,9 +98,12 @@ def f():
print e
f()
f()
f()
def f():
class C(object):
pass
class D(object):
@make_closure
def __get__(self, obj, type, other_arg=2.4**10):
......@@ -125,14 +134,41 @@ def f():
print c.x
f()
f()
f()
# Deleting the descriptor object itself:
def f():
class C(object):
pass
class D(object):
def __get__(self, obj, type, other_arg=2.4**10):
print "D.__get__"
print other_arg
del C.x
print other_arg
sys._clear_type_cache()
print other_arg
return 1
C.x = D()
c = C()
print c.x
print c.x
f()
f()
f()
# TODO: lots of other cases that could/should get tested.
# Related:
@make_closure
def f(a1=2.0**10, a2=2.1**10):
f.func_defaults = ()
print a1, a2
del globals()['f']
def f():
@make_closure
def g(a1=2.0**10, a2=2.1**10):
f.func_defaults = ()
print a1, a2
del globals()['f']
g()
f()
f()
f()
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