Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
Next Next commit
rephrased the comment about how we ensure identical behaviour with NumPy
  • Loading branch information
bszollosinagy committed Jan 10, 2023
commit 61fb113ee1aaffd05b25c2cd12d123fd8b81fe6e
9 changes: 6 additions & 3 deletions numba/core/typing/arraydecl.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,9 +486,12 @@ def resolve_flatten(self, ary, args, kws):
# Only support no argument version (default order='C')
assert not kws
assert not args
# Just like in Numpy: "np.copy clears previously
# set WRITEABLE=False flag"
# Numba also sets readonly=False (b/c flatten returns a copy())
# To ensure that Numba behaves exactly like Numpy,
# we also clear the read-only flag when doing a "flatten"
# Why? Two reasons:
# Because flatten always returns a copy. (see NumPy docs for "flatten")
# And because a copy always returns a writeable array.
# ref: https://numpy.org/doc/stable/reference/generated/numpy.copy.html
return signature(ary.copy(ndim=1, layout='C', readonly=False))

def generic_resolve(self, ary, attr):
Expand Down