diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2020-01-22 23:32:10 +0000 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2020-01-23 10:29:04 +0000 |
commit | b0544ff0cd7e8df54bdb5309289964d76e1539c9 (patch) | |
tree | fab5c6789d33d0d768e10541f6adfe19c4695d00 /numpy/core | |
parent | e94cec800304a6a467cf90ce4e7d3e207770b4b4 (diff) | |
download | numpy-b0544ff0cd7e8df54bdb5309289964d76e1539c9.tar.gz |
MAINT: Remove leftover code which handled integer base classes
This seems to be left from when `np.int_` subclassed `int`, which it no longer does.
Change the `if` to an `assert` so that we can catch this type of change in future.
Diffstat (limited to 'numpy/core')
-rw-r--r-- | numpy/core/src/multiarray/scalartypes.c.src | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/numpy/core/src/multiarray/scalartypes.c.src b/numpy/core/src/multiarray/scalartypes.c.src index cd26d20fa..6390fda68 100644 --- a/numpy/core/src/multiarray/scalartypes.c.src +++ b/numpy/core/src/multiarray/scalartypes.c.src @@ -2563,20 +2563,18 @@ object_arrtype_dealloc(PyObject *v) */ #define _WORK(num) \ - if (type->tp_bases && (PyTuple_GET_SIZE(type->tp_bases)==2)) { \ - PyTypeObject *sup; \ - /* We are inheriting from a Python type as well so \ - give it first dibs on conversion */ \ - sup = (PyTypeObject *)PyTuple_GET_ITEM(type->tp_bases, num); \ - /* Prevent recursion */ \ - if (thisfunc != sup->tp_new) { \ - robj = sup->tp_new(type, args, kwds); \ - if (robj != NULL) goto finish; \ - if (PyTuple_GET_SIZE(args)!=1) return NULL; \ - PyErr_Clear(); \ - } \ - /* now do default conversion */ \ - } + assert(type->tp_bases && (PyTuple_GET_SIZE(type->tp_bases) == 2)); \ + /* We are inheriting from a Python type as well so \ + give it first dibs on conversion */ \ + PyTypeObject *sup = (PyTypeObject *)PyTuple_GET_ITEM(type->tp_bases, num); \ + /* Prevent recursion */ \ + if (thisfunc != sup->tp_new) { \ + robj = sup->tp_new(type, args, kwds); \ + if (robj != NULL) goto finish; \ + if (PyTuple_GET_SIZE(args) != 1) return NULL; \ + PyErr_Clear(); \ + } \ + /* now do default conversion */ #define _WORK1 _WORK(1) #define _WORKz _WORK(0) @@ -2592,7 +2590,7 @@ object_arrtype_dealloc(PyObject *v) * #TYPE = BYTE, SHORT, INT, LONG, LONGLONG, UBYTE, USHORT, UINT, ULONG, * ULONGLONG, HALF, FLOAT, DOUBLE, LONGDOUBLE, CFLOAT, CDOUBLE, * CLONGDOUBLE, STRING, UNICODE, OBJECT# - * #work = 0,0,1,1,1,0,0,0,0,0,0,0,1,0,0,0,0,z,z,0# + * #work = 0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,z,z,0# * #default = 0*17,1*2,2# */ |