<p dir="auto">Not sure if this is supposed to be like this.</p>
<p dir="auto">original issue here: <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="34931590" data-permission-text="Title is private" data-url="https://github.com/pandas-dev/pandas/issues/7332" data-hovercard-type="issue" data-hovercard-url="/pandas-dev/pandas/issues/7332/hovercard" href="https://github.com/pandas-dev/pandas/issues/7332">pandas-dev/pandas#7332</a><br>
cross post to numexpr here: <a href="https://code.google.com/p/numexpr/issues/detail?id=126" rel="nofollow">https://code.google.com/p/numexpr/issues/detail?id=126</a></p>
<p dir="auto">essentially in pandas were looking up a <code class="notranslate">dtype,type</code> in a cython dictionary</p>
<p dir="auto">turns out that for <code class="notranslate">int64</code> (and <code class="notranslate">int32</code> but NOT <code class="notranslate">int64</code> on 32-bit platforms), the hashes are DIFFERENT, but same for other dtypes (including <code class="notranslate">float64</code>).</p>
<p dir="auto">Is this maybe an implementation detail on <code class="notranslate">numexpr</code> and/or incorrect usage of <code class="notranslate">dtype.type</code> and/or invalid guarantees on this object?</p>
<p dir="auto">FYI, we switched to using <code class="notranslate">dtype.name</code> for the lookup and no issues.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="In [20]: import numexpr as ne
In [21]: import numpy as np
In [22]: ne.__version__
Out[22]: '2.4'
In [23]: np.__version__
Out[23]: '1.8.1'

In [24]: a = np.arange(10,dtype='int64')
In [25]: b = np.arange(10,dtype='int64')

In [26]: result_ne = ne.evaluate('a+b')
In [27]: result_numpy = a+b

In [28]: (result_ne == result_numpy).all()
Out[28]: True

In [29]: result_ne.dtype.type
Out[29]: numpy.int64

In [30]: result_numpy.dtype.type
Out[30]: numpy.int64

In [31]: hash(result_ne.dtype.type)
Out[31]: 8768103730016

In [32]: hash(result_numpy.dtype.type)
Out[32]: 8768103729990"><pre class="notranslate"><code class="notranslate">In [20]: import numexpr as ne
In [21]: import numpy as np
In [22]: ne.__version__
Out[22]: '2.4'
In [23]: np.__version__
Out[23]: '1.8.1'

In [24]: a = np.arange(10,dtype='int64')
In [25]: b = np.arange(10,dtype='int64')

In [26]: result_ne = ne.evaluate('a+b')
In [27]: result_numpy = a+b

In [28]: (result_ne == result_numpy).all()
Out[28]: True

In [29]: result_ne.dtype.type
Out[29]: numpy.int64

In [30]: result_numpy.dtype.type
Out[30]: numpy.int64

In [31]: hash(result_ne.dtype.type)
Out[31]: 8768103730016

In [32]: hash(result_numpy.dtype.type)
Out[32]: 8768103729990
</code></pre></div>
<p dir="auto">For the floats the same though</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="In [1]: a = np.arange(10.)

In [2]: b = np.arange(10.)

n [4]: hash(ne.evaluate('a+b').dtype.type)
Out[4]: 8751212391216

In [5]: hash((a+b).dtype.type)
Out[5]: 8751212391216"><pre class="notranslate"><code class="notranslate">In [1]: a = np.arange(10.)

In [2]: b = np.arange(10.)

n [4]: hash(ne.evaluate('a+b').dtype.type)
Out[4]: 8751212391216

In [5]: hash((a+b).dtype.type)
Out[5]: 8751212391216
</code></pre></div>
<p dir="auto">The current documentation of <a href="https://docs.scipy.org/doc/numpy-dev/reference/c-api.dtype.html" rel="nofollow">enumerated types</a> makes me think there are 8 values possible for integers ((signed, unsigned) * (8, 16, 32, 64) bits).</p>
<p dir="auto">However, if I dump the values of the enumeration I have results that are not consistent with the documentation:</p>
<p dir="auto">Windows x64 (with <code class="notranslate">sizeof(long) = 4</code>)</p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="NPY_BYTE = 1
NPY_UBYTE = 2
NPY_INT8 = 1
NPY_UINT8 = 2
NPY_SHORT = 3
NPY_USHORT = 4
NPY_INT16 = 3
NPY_UINT16 = 4
NPY_INT = 5
NPY_UINT = 6
NPY_INT32 = 7
NPY_UINT32 = 8
NPY_LONG = 7
NPY_ULONG = 8
NPY_INT64 = 9
NPY_UINT64 = 10
NPY_LONGLONG = 9
NPY_ULONGLONG = 10"><pre class="notranslate">NPY_BYTE = 1
NPY_UBYTE = 2
NPY_INT8 = 1
NPY_UINT8 = 2
NPY_SHORT = 3
NPY_USHORT = 4
NPY_INT16 = 3
NPY_UINT16 = 4
NPY_INT = 5
NPY_UINT = 6
NPY_INT32 = 7
NPY_UINT32 = 8
NPY_LONG = 7
NPY_ULONG = 8
NPY_INT64 = 9
NPY_UINT64 = 10
NPY_LONGLONG = 9
NPY_ULONGLONG = 10</pre></div>
<p dir="auto"><code class="notranslate">NPY_INT</code> and <code class="notranslate">NPY_INT32</code> differ (the same for <code class="notranslate">NPY_UINT</code> and <code class="notranslate">NPY_UIN32</code>).</p>
<p dir="auto">Linux x64 (with <code class="notranslate">sizeof(long) = 8</code>)</p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="NPY_BYTE = 1
NPY_UBYTE = 2
NPY_INT8 = 1
NPY_UINT8 = 2
NPY_SHORT = 3
NPY_USHORT = 4
NPY_INT16 = 3
NPY_UINT16 = 4
NPY_INT = 5
NPY_UINT = 6
NPY_INT32 = 5
NPY_UINT32 = 6
NPY_LONG = 7
NPY_ULONG = 8
NPY_INT64 = 7
NPY_UINT64 = 8
NPY_LONGLONG = 9
NPY_ULONGLONG = 10"><pre class="notranslate">NPY_BYTE = 1
NPY_UBYTE = 2
NPY_INT8 = 1
NPY_UINT8 = 2
NPY_SHORT = 3
NPY_USHORT = 4
NPY_INT16 = 3
NPY_UINT16 = 4
NPY_INT = 5
NPY_UINT = 6
NPY_INT32 = 5
NPY_UINT32 = 6
NPY_LONG = 7
NPY_ULONG = 8
NPY_INT64 = 7
NPY_UINT64 = 8
NPY_LONGLONG = 9
NPY_ULONGLONG = 10</pre></div>
<p dir="auto">Here, <code class="notranslate">NPY_INT64</code> and <code class="notranslate">NPY_LONGLONG</code> differ (the same for <code class="notranslate">NPY_UIN64</code> and <code class="notranslate">NPY_ULONGLONG</code>)<br>
In both cases (Windows and Linux) we have 10 values for integer instead of 8.</p>
<p dir="auto">Is that expected ? I'm using numpy v1.13.3.</p>
<p dir="auto">cc <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/wolfv/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/wolfv">@wolfv</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/SylvainCorlay/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/SylvainCorlay">@SylvainCorlay</a></p>