py: Wrap all obj-ptr conversions in MP_OBJ_TO_PTR/MP_OBJ_FROM_PTR.

This allows the mp_obj_t type to be configured to something other than a
pointer-sized primitive type.

This patch also includes additional changes to allow the code to compile
when sizeof(mp_uint_t) != sizeof(void*), such as using size_t instead of
mp_uint_t, and various casts.
diff --git a/py/stream.h b/py/stream.h
index 1676121..b3958d3 100644
--- a/py/stream.h
+++ b/py/stream.h
@@ -51,3 +51,4 @@
 #endif
 
 #endif // __MICROPY_INCLUDED_PY_STREAM_H__
+void mp_stream_write_adaptor(void *self, const char *buf, size_t len);