summaryrefslogtreecommitdiffstats
path: root/AppPkg/Applications/Python/Python-2.7.2/Lib/test/crashers/borrowed_ref_1.py
diff options
context:
space:
mode:
Diffstat (limited to 'AppPkg/Applications/Python/Python-2.7.2/Lib/test/crashers/borrowed_ref_1.py')
-rw-r--r--AppPkg/Applications/Python/Python-2.7.2/Lib/test/crashers/borrowed_ref_1.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/AppPkg/Applications/Python/Python-2.7.2/Lib/test/crashers/borrowed_ref_1.py b/AppPkg/Applications/Python/Python-2.7.2/Lib/test/crashers/borrowed_ref_1.py
new file mode 100644
index 0000000000..26d55b728f
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.2/Lib/test/crashers/borrowed_ref_1.py
@@ -0,0 +1,29 @@
+"""
+_PyType_Lookup() returns a borrowed reference.
+This attacks the call in dictobject.c.
+"""
+
+class A(object):
+ pass
+
+class B(object):
+ def __del__(self):
+ print 'hi'
+ del D.__missing__
+
+class D(dict):
+ class __missing__:
+ def __init__(self, *args):
+ pass
+
+
+d = D()
+a = A()
+a.cycle = a
+a.other = B()
+del a
+
+prev = None
+while 1:
+ d[5]
+ prev = (prev,)