question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Improving the error message when adding i8 array to u8 array

See original GitHub issue

When attempting to add an ndarray of type int64 to an ndarray of type uint64, numpy throws a TypeError:

TypeError: Cannot cast ufunc add output from dtype('float64') to dtype('uint64') with casting rule 'same_kind'

The error message incorrectly identifies the type of the first array as float64, when it is actually int64.

Reproducing code example:

import numpy as np
x = np.arange(5, dtype='u8')
y = np.arange(5, dtype='i8')
x += y

Error message:

TypeError: Cannot cast ufunc add output from dtype('float64') to dtype('uint64') with casting rule 'same_kind'

Numpy/Python version information:

Tested with Python 3:

1.16.4 3.6.8 (default, Oct  7 2019, 12:59:55) 
[GCC 8.3.0]

Also with Python 2:

('1.15.1', '2.7.15+ (default, Oct  7 2019, 17:39:04) \n[GCC 7.4.0]')

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
eric-wiesercommented, Apr 21, 2020

Let’s wait and see if any progress is made on #14843

0reactions
mattipcommented, Oct 16, 2020

Hi @5aumy4, welcome. As with many of these issues, it turns out to be more difficult than a simple error message change. See gh-14843.

As for getting started, you can read our contribution guide

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error to append a converted u8 (from i8) to an ArrayList, only ...
This has nothing to do with the intCast, the issue is that the function's return type does not allow for a possible error...
Read more >
How to convert &[i8] to &[u8]? - Rust Users Forum
I tried to use let u8slice : &[u8] = i8slice as &[u8]; But it complains an as expression can only be used to...
Read more >
Arrays and pointers questions - Xilinx Support
I'm getting errors when trying to synthesize, such as unsupported pointer reinterpretation from type 'i16*' to type 'i8*' when casting ...
Read more >
TypedArray - JavaScript - MDN Web Docs
A TypedArray object describes an array-like view of an underlying binary data buffer. There is no global property named TypedArray, ...
Read more >
LLVM Language Reference Manual
Scalable vectors cannot be global variables or members of arrays because ... be placed into special subsection of the text section to improving...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found