<s> import weakref <EOL> import array <EOL> import re <EOL> def test_wr ( o , extra = None ) : <EOL> if extra is None : <EOL> extra = type ( o ) <EOL> try : <EOL> r = weakref . ref ( o ) <EOL> print "<STR_LIT>" , extra <EOL> return r <EOL> except : <EOL> print "<STR_LIT>" , extra <EOL> def test_subclass_wr ( tp ) : <EOL> class test ( tp ) : pass <EOL> test_wr ( test ( ) , "<STR_LIT>" + repr ( tp ) ) <EOL> def test ( ) : <EOL> pass <EOL> wr = test_wr ( test ) <EOL> print wr ( ) == test <EOL> print weakref . getweakrefcount ( test ) <EOL> test_wr ( <NUM_LIT:1> ) <EOL> test_wr ( <NUM_LIT:1.> ) <EOL> test_wr ( <NUM_LIT:1> L ) <EOL> test_wr ( "<STR_LIT>" ) <EOL> test_wr ( [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] ) <EOL> test_wr ( ( <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:2> ) ) <EOL> test_wr ( set ( ) ) <EOL> test_wr ( frozenset ( ) ) <EOL> test_wr ( ( i * i for i in range ( <NUM_LIT> ) ) ) <EOL> test_wr ( set ) <EOL> test_wr ( file ( "<STR_LIT>" ) ) <EOL> class Old : <EOL> pass <EOL> test_wr ( Old ) <EOL> test_wr ( array . array ( '<STR_LIT:d>' , [ <NUM_LIT:1.0> , <NUM_LIT> , <NUM_LIT> ] ) ) <EOL> test_wr ( re . compile ( '<STR_LIT>' ) ) <EOL> test_subclass_wr ( int ) <EOL> test_subclass_wr ( float ) </s>
