added possibility to encode a iterator like objects

tests are passed. (I tests it on python3)
fixed crash when double_precision option is specified in python3 x86_64
I think the current use cases should not be affected, because I only add a new type.