encode_value(object) doesn't throw when object is missing _encode

Imported from http://bugzilla.roxen.com/bugzilla/show_bug.cgi?id=2694

Reported by Martin Nilsson, IDA nilsson@pike.ida.liu.se

> string x = encode_value(Image.Image(100,100));
Result: "¶ke0#("
> decode_value(x);
Result: 0