diff options
| author | Damien George <damien.p.george@gmail.com> | 2014-07-24 14:21:37 +0100 | 
|---|---|---|
| committer | Damien George <damien.p.george@gmail.com> | 2014-07-24 14:21:37 +0100 | 
| commit | ffe911d228c3b7e35ef6ae775c802cdd05cffa47 (patch) | |
| tree | 0cb1c7c2e8ef4724a8a8f2c21613e65d88cb69e0 /py/obj.c | |
| parent | 4ecb700fe34491c563372ffa72387ef6d45ce5d8 (diff) | |
py: Make long ints hashable.
Addresses issue #765.
Diffstat (limited to 'py/obj.c')
| -rw-r--r-- | py/obj.c | 5 | 
1 files changed, 5 insertions, 0 deletions
| @@ -24,6 +24,7 @@   * THE SOFTWARE.   */ +#include <stdint.h>  #include <stdio.h>  #include <stdarg.h>  #include <assert.h> @@ -33,6 +34,8 @@  #include "misc.h"  #include "qstr.h"  #include "obj.h" +#include "mpz.h" +#include "objint.h"  #include "runtime0.h"  #include "runtime.h"  #include "stackctrl.h" @@ -152,6 +155,8 @@ mp_int_t mp_obj_hash(mp_obj_t o_in) {          return 1; // needs to hash to same as the integer 1, since True==1      } else if (MP_OBJ_IS_SMALL_INT(o_in)) {          return MP_OBJ_SMALL_INT_VALUE(o_in); +    } else if (MP_OBJ_IS_TYPE(o_in, &mp_type_int)) { +        return mp_obj_int_hash(o_in);      } else if (MP_OBJ_IS_STR(o_in) || MP_OBJ_IS_TYPE(o_in, &mp_type_bytes)) {          return mp_obj_str_get_hash(o_in);      } else if (MP_OBJ_IS_TYPE(o_in, &mp_type_NoneType)) { | 
