8000 MAINT: Temporarily disable __numpy_ufunc__ for 1.10 by njsmith · Pull Request #6102 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

MAINT: Temporarily disable __numpy_ufunc__ for 1.10 #6102

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
MAINT: Temporarily disable __numpy_ufunc__ for 1.10
Following discussion in gh-5844, we regretfully decided that we have to
disable __numpy_ufunc__ again for 1.10. This patch should be reverted
on master after 1.10 is branched.
  • Loading branch information
njsmith committed Jul 24, 2015
commit e2dd12a371fd5cba2610a3869c76d000cc102db8
10 changes: 10 additions & 0 deletions numpy/core/src/private/ufunc_override.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,16 @@ PyUFunc_CheckOverride(PyUFuncObject *ufunc, char *method,
/* Pos of each override in args */
int with_override_pos[NPY_MAXARGS];

/****************************************************************
* Temporarily disable this functionality for the 1.10 release.
* See gh-5844.
****************************************************************/
*result = NULL;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are declarations after this code, leading to errors.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

return 0;
/****************************************************************
* Actual implementation follows:
****************************************************************/

/*
* Check inputs
*/
Expand Down
17 changes: 17 additions & 0 deletions numpy/core/tests/test_multiarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -1923,6 +1923,9 @@ def test_dot(self):
assert_equal(c, np.dot(a, b))

def test_dot_override(self):
# Temporarily disable __numpy_ufunc__ for 1.10; see gh-5844
return

class A(object):
def __numpy_ufunc__(self, ufunc, method, pos, inputs, **kwargs):
return "A"
Expand Down Expand Up @@ -2246,6 +2249,9 @@ def test_ufunc_override_rop_precedence(self):
# Check that __rmul__ and other right-hand operations have
# precedence over __numpy_ufunc__

# Temporarily disable __numpy_ufunc__ for 1.10; see gh-5844
return

ops = {
'__add__': ('__radd__', np.add, True),
'__sub__': ('__rsub__', np.subtract, True),
Expand Down Expand Up @@ -2361,6 +2367,9 @@ def __rop__(self, *other):
yield check, op_name, False

def test_ufunc_override_rop_simple(self):
# Temporarily disable __numpy_ufunc__ for 1.10; see gh-5864
return

# Check parts of the binary op overriding behavior in an
# explicit test case that is easier to understand.
class SomeClass(object):
Expand Down Expand Up @@ -2460,6 +2469,9 @@ def __rsub__(self, other):
assert_(isinstance(res, SomeClass3))

def test_ufunc_override_normalize_signature(self):
# Temporarily disable __numpy_ufunc__ for 1.10; see gh-5844
return

# gh-5674
class SomeClass(object):
def __numpy_ufunc__(self, ufunc, method, i, inputs, **kw):
Expand Down Expand Up @@ -3998,6 +4010,9 @@ def test_dot_scalar_and_matrix_of_objects(self):
assert_equal(np.dot(3, arr), desired)

def test_dot_override(self):
# Temporarily disable __numpy_ufunc__ for 1.10; see gh-5844
return

class A(object):
def __numpy_ufunc__(self, ufunc, method, pos, inputs, **kwargs):
return "A"
Expand Down Expand Up @@ -4279,6 +4294,8 @@ def test_matrix_matrix_values(self):
assert_equal(res, tgt12_21)

def test_numpy_ufunc_override(self):
# Temporarily disable __numpy_ufunc__ for 1.10; see gh-5844
return

class A(np.ndarray):
def __new__(cls, *args, **kwargs):
Expand Down
14 changes: 14 additions & 0 deletions numpy/core/tests/test_umath.py
Original file line number Diff line number Diff line change
Expand Up @@ -1162,6 +1162,9 @@ def __array__(self):
assert_equal(ncu.maximum(a, C()), 0)

def test_ufunc_override(self):
# Temporarily disable __numpy_ufunc__ for 1.10; see gh-5844
return

class A(object):
def __numpy_ufunc__(self, func, method, pos, inputs, **kwargs):
return self, func, method, pos, inputs, kwargs
Expand All @@ -1188,6 +1191,8 @@ def __numpy_ufunc__(self, func, method, pos, inputs, **kwargs):
assert_equal(res1[5], {})

def test_ufunc_override_mro(self):
# Temporarily disable __numpy_ufunc__ for 1.10; see gh-5864
return

# Some multi arg functions for testing.
def tres_mul(a, b, c):
Expand Down Expand Up @@ -1281,6 +1286,9 @@ def __numpy_ufunc__(self, func, method, pos, inputs, **kwargs):
assert_raises(TypeError, four_mul_ufunc, 1, c, c_sub, c)

def test_ufunc_override_methods(self):
# Temporarily disable __numpy_ufunc__ for 1.10; see gh-5864
return

class A(object):
def __numpy_ufunc__(self, ufunc, method, pos, inputs, **kwargs):
return self, ufunc, method, pos, inputs, kwargs
Expand Down Expand Up @@ -1384,6 +1392,9 @@ def __numpy_ufunc__(self, ufunc, method, pos, inputs, **kwargs):
assert_equal(res[4], (a, [4, 2], 'b0'))

def test_ufunc_override_out(self):
# Temporarily disable __numpy_ufunc__ for 1.10; see gh-5844
return

class A(object):
def __numpy_ufunc__(self, ufunc, method, pos, inputs, **kwargs):
return kwargs
Expand Down Expand Up @@ -1418,6 +1429,9 @@ def __numpy_ufunc__(self, ufunc, method, pos, inputs, **kwargs):
assert_equal(res7['out'][1], 'out1')

def test_ufunc_override_exception(self):
# Temporarily disable __numpy_ufunc__ for 1.10; see gh-5864
return

class A(object):
def __numpy_ufunc__(self, *a, **kwargs):
raise ValueError("oops")
Expand Down
0