@@ -262,15 +262,23 @@ def make_dt_codes(codes):
262
262
of the corresponding code, name, type, dtype, or swapped dtype
263
263
'''
264
264
dt_codes = []
265
+ intp_dt = np .dtype (np .intp )
265
266
for code , name , np_type in codes :
266
267
this_dt = np .dtype (np_type )
268
+ code_syns = [code , name , np_type ]
269
+ dtypes = [this_dt ]
270
+ # intp type is effectively same as int32 on 32 bit and int64 on 64 bit.
271
+ # They compare equal, but in some (all?) numpy versions, they may hash
272
+ # differently. If so we need to add them
273
+ if this_dt == intp_dt and hash (this_dt ) != hash (intp_dt ):
274
+ dtypes .append (intp_dt )
267
275
# To satisfy an oddness in numpy dtype hashing, we need to add the dtype
268
- # with native order as well as the default dtype (=) order
269
- dt_codes . append (( code , name ,
270
- np_type ,
271
- this_dt ,
272
- this_dt .newbyteorder (native_code ),
273
- this_dt . newbyteorder ( swapped_code )) )
276
+ # with explicit native order as well as the default dtype (=) order
277
+ for dt in dtypes :
278
+ code_syns += [ dt ,
279
+ dt . newbyteorder ( native_code ) ,
280
+ dt .newbyteorder (swapped_code )]
281
+ dt_codes . append ( code_syns )
274
282
return Recoder (dt_codes ,
275
283
fields = ('code' ,
276
284
'label' ,
0 commit comments