Kaydet (Commit) d77ef8fa authored tarafından Armin Rigo's avatar Armin Rigo

A couple of crashers of the "won't fix" kind.

üst 999a336a
"""
Broken bytecode objects can easily crash the interpreter.
"""
import types
co = types.CodeType(0, 0, 0, 0, '\x04\x71\x00\x00', (),
(), (), '', '', 1, '')
exec co
"""
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())
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