diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2020-01-23 10:30:15 +0000 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2020-01-23 10:31:33 +0000 |
commit | c0ca8143aa98a2623a28a748648da9c3667695c0 (patch) | |
tree | 740ccb1c5072d60ac535dbac26b2ee3dde516679 /numpy/array_api/_array_object.py | |
parent | b0544ff0cd7e8df54bdb5309289964d76e1539c9 (diff) | |
download | numpy-c0ca8143aa98a2623a28a748648da9c3667695c0.tar.gz |
BUG: Do not dispatch to base classes polymorphically
The previously code was equivalent to something like
```python
class SomeScalar(base1, base2):
def __new__(cls, *args):
return cls.__bases__[1].__new__(*args)
```
This is nonsense and can easily cause recursion, for instance if `cls` is a superclass of SomeScalar.
The correct way to spell this is to pin the base class call statically.
```python
class SomeScalar(base1, base2):
def __new__(cls, *args):
return SomeScalar.__bases__[1].__new__(*args)
```
Fixes #15395
Diffstat (limited to 'numpy/array_api/_array_object.py')
0 files changed, 0 insertions, 0 deletions