unix microsocket: Add dummy makefile() method.
Unlike CPython socket, microsocket object already implements stream protocol (read/write methods), so makefile() just returns object itself. TODO: this doesn't take care of arguments CPython's makefile() may accept.
This commit is contained in:
parent
21c51f0bde
commit
557c9d5264
1
py/obj.c
1
py/obj.c
|
@ -253,3 +253,4 @@ mp_obj_t mp_obj_len_maybe(mp_obj_t o_in) {
|
|||
mp_obj_t mp_identity(mp_obj_t self) {
|
||||
return self;
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(mp_identity_obj, mp_identity);
|
||||
|
|
1
py/obj.h
1
py/obj.h
|
@ -370,6 +370,7 @@ extern const mp_obj_type_t fun_bc_type;
|
|||
void mp_obj_fun_bc_get(mp_obj_t self_in, int *n_args, uint *n_state, const byte **code);
|
||||
|
||||
mp_obj_t mp_identity(mp_obj_t self);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_identity_obj);
|
||||
|
||||
// super
|
||||
extern const mp_obj_type_t super_type;
|
||||
|
|
|
@ -216,6 +216,7 @@ static mp_obj_t socket_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const
|
|||
|
||||
static const mp_method_t microsocket_type_methods[] = {
|
||||
{ "fileno", &socket_fileno_obj },
|
||||
{ "makefile", &mp_identity_obj },
|
||||
{ "read", &mp_stream_read_obj },
|
||||
{ "readall", &mp_stream_readall_obj },
|
||||
{ "readline", &mp_stream_unbuffered_readline_obj},
|
||||
|
|
Loading…
Reference in New Issue