diff --git a/py/obj.h b/py/obj.h
index 8286ba447bac84127b7a1e9c01541eac045cfa9f..25f31ea5adf1588eb9494157e4ab0eba7478dd0b 100644
--- a/py/obj.h
+++ b/py/obj.h
@@ -444,7 +444,6 @@ bool mp_get_buffer(mp_obj_t obj, mp_buffer_info_t *bufinfo, mp_uint_t flags);
 void mp_get_buffer_raise(mp_obj_t obj, mp_buffer_info_t *bufinfo, mp_uint_t flags);
 
 // Stream protocol
-#define MP_STREAM_ERROR ((mp_uint_t)-1)
 typedef struct _mp_stream_p_t {
     // On error, functions should return MP_STREAM_ERROR and fill in *errcode (values
     // are implementation-dependent, but will be exposed to user, e.g. via exception).
@@ -454,17 +453,6 @@ typedef struct _mp_stream_p_t {
     mp_uint_t is_text : 1; // default is bytes, set this for text stream
 } mp_stream_p_t;
 
-// Stream ioctl request codes
-#define MP_STREAM_FLUSH (1)
-#define MP_STREAM_SEEK  (2)
-#define MP_STREAM_POLL  (3)
-
-// Argument structure for MP_STREAM_SEEK
-struct mp_stream_seek_t {
-    mp_off_t offset;
-    int whence;
-};
-
 struct _mp_obj_type_t {
     mp_obj_base_t base;
     qstr name;
diff --git a/py/stream.h b/py/stream.h
index 2354fd3c0f3ce6fc1b62b8197891036b3de6f185..8e7f8af631c53f92088b1754f14a3050bdb5b80e 100644
--- a/py/stream.h
+++ b/py/stream.h
@@ -28,6 +28,19 @@
 
 #include "py/obj.h"
 
+#define MP_STREAM_ERROR ((mp_uint_t)-1)
+
+// Stream ioctl request codes
+#define MP_STREAM_FLUSH (1)
+#define MP_STREAM_SEEK  (2)
+#define MP_STREAM_POLL  (3)
+
+// Argument structure for MP_STREAM_SEEK
+struct mp_stream_seek_t {
+    mp_off_t offset;
+    int whence;
+};
+
 MP_DECLARE_CONST_FUN_OBJ(mp_stream_read_obj);
 MP_DECLARE_CONST_FUN_OBJ(mp_stream_readinto_obj);
 MP_DECLARE_CONST_FUN_OBJ(mp_stream_readall_obj);