-
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
42 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
diff --git a/libs/python/src/numpy/dtype.cpp b/libs/python/src/numpy/dtype.cpp | ||
index da30d192..1ce8c6ec 100644 | ||
--- a/libs/python/src/numpy/dtype.cpp | ||
+++ b/libs/python/src/numpy/dtype.cpp | ||
@@ -107,32 +107,7 @@ int dtype::get_itemsize() const { | ||
} | ||
|
||
bool equivalent(dtype const & a, dtype const & b) { | ||
- // On Windows x64, the behaviour described on | ||
- // http://docs.scipy.org/doc/numpy/reference/c-api.array.html for | ||
- // PyArray_EquivTypes unfortunately does not extend as expected: | ||
- // "For example, on 32-bit platforms, NPY_LONG and NPY_INT are equivalent". | ||
- // This should also hold for 64-bit platforms (and does on Linux), but not | ||
- // on Windows. Implement an alternative: | ||
-#ifdef _MSC_VER | ||
- if (sizeof(long) == sizeof(int) && | ||
- // Manually take care of the type equivalence. | ||
- ((a == dtype::get_builtin<long>() || a == dtype::get_builtin<int>()) && | ||
- (b == dtype::get_builtin<long>() || b == dtype::get_builtin<int>()) || | ||
- (a == dtype::get_builtin<unsigned int>() || a == dtype::get_builtin<unsigned long>()) && | ||
- (b == dtype::get_builtin<unsigned int>() || b == dtype::get_builtin<unsigned long>()))) { | ||
- return true; | ||
- } else { | ||
- return PyArray_EquivTypes( | ||
- reinterpret_cast<PyArray_Descr*>(a.ptr()), | ||
- reinterpret_cast<PyArray_Descr*>(b.ptr()) | ||
- ); | ||
- } | ||
-#else | ||
- return PyArray_EquivTypes( | ||
- reinterpret_cast<PyArray_Descr*>(a.ptr()), | ||
- reinterpret_cast<PyArray_Descr*>(b.ptr()) | ||
- ); | ||
-#endif | ||
+ return a == b; | ||
} | ||
|
||
namespace |