py: Make MP_OBJ_NEW_SMALL_INT cast arg to mp_int_t itself.

Addresses issue #724.
This commit is contained in:
Damien George
2014-07-31 10:49:14 +01:00
parent fa1ecda3fd
commit bb4c6f35c6
17 changed files with 44 additions and 44 deletions

View File

@@ -114,7 +114,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(fdfile___exit___obj, 4, 4, fdfile___e
STATIC mp_obj_t fdfile_fileno(mp_obj_t self_in) {
mp_obj_fdfile_t *self = self_in;
check_fd_is_open(self);
return MP_OBJ_NEW_SMALL_INT((mp_int_t)self->fd);
return MP_OBJ_NEW_SMALL_INT(self->fd);
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(fdfile_fileno_obj, fdfile_fileno);
@@ -167,7 +167,7 @@ STATIC mp_obj_t fdfile_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const
const char *fname = mp_obj_str_get_str(args[0]);
int fd = open(fname, mode, 0644);
if (fd == -1) {
nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT((mp_int_t)errno)));
nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(errno)));
}
o->fd = fd;
return o;