[Python-checkins] r47143 - python/trunk/Lib/test/crashers/bogus_code_obj.py python/trunk/Lib/test/crashers/gc_inspection.py
armin.rigo
python-checkins at python.org
Wed Jun 28 12:49:51 CEST 2006
Author: armin.rigo
Date: Wed Jun 28 12:49:51 2006
New Revision: 47143
Added:
python/trunk/Lib/test/crashers/bogus_code_obj.py (contents, props changed)
python/trunk/Lib/test/crashers/gc_inspection.py (contents, props changed)
Log:
A couple of crashers of the "won't fix" kind.
Added: python/trunk/Lib/test/crashers/bogus_code_obj.py
==============================================================================
--- (empty file)
+++ python/trunk/Lib/test/crashers/bogus_code_obj.py Wed Jun 28 12:49:51 2006
@@ -0,0 +1,9 @@
+"""
+Broken bytecode objects can easily crash the interpreter.
+"""
+
+import types
+
+co = types.CodeType(0, 0, 0, 0, '\x04\x71\x00\x00', (),
+ (), (), '', '', 1, '')
+exec co
Added: python/trunk/Lib/test/crashers/gc_inspection.py
==============================================================================
--- (empty file)
+++ python/trunk/Lib/test/crashers/gc_inspection.py Wed Jun 28 12:49:51 2006
@@ -0,0 +1,17 @@
+"""
+gc.get_referrers() can be used to see objects before they are fully built.
+"""
+
+import gc
+
+
+def g():
+ marker = object()
+ yield marker
+ # now the marker is in the tuple being constructed
+ [tup] = [x for x in gc.get_referrers(marker) if type(x) is tuple]
+ print tup
+ print tup[1]
+
+
+tuple(g())
More information about the Python-checkins
mailing list