Skip to content
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

Len of two concatenated Bytes objects is 0 #8305

Open
2 tasks done
allai5 opened this issue Aug 2, 2022 · 3 comments
Open
2 tasks done

Len of two concatenated Bytes objects is 0 #8305

allai5 opened this issue Aug 2, 2022 · 3 comments
Labels
bug - incorrect behavior Bugs: incorrect behavior

Comments

@allai5
Copy link

allai5 commented Aug 2, 2022

import numba
import numpy as np


@numba.njit
def addbytes_len_usecase(a, b):
    output = len(b''.join([a, b]))
    return output

b_val = b"abcd"
addbytes_len_ans = addbytes_len_usecase(b_val, b_val) 
print(f"addbytes_len_ans: {addbytes_len_ans}")

Returns 0.

Reporting a bug

  • I have tried using the latest released version of Numba (most recent is
    visible in the change log (https://github.com/numba/numba/blob/main/CHANGE_LOG).
  • I have included a self contained code sample to reproduce the problem.
    i.e. it's possible to run as 'python bug.py'.
@njriasan
Copy link
Contributor

njriasan commented Aug 2, 2022

So the core of this issue is the types.Bytes being ArrayCompatable. However, this particular issue is related to _make_constant_bytes setting bstr.shape and bstr.strides to null. In case the Bytes refactoring gets delayed I would merge a fix for this now. @allai5 will open a PR.

@esc
Copy link
Member

esc commented Aug 3, 2022

@allai5 @njriasan thank you for bringing this up. I presume #8305 will fix?

@njriasan
Copy link
Contributor

njriasan commented Aug 8, 2022

@esc That links back to this issue. Do you mean #8306? If so yes that fixes it. However, this should also be fixed as part of a general Bytes refactoring to remove ArrayCompatible (which I am working on but have only just started).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug - incorrect behavior Bugs: incorrect behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants