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

fixes to colonful reshape #54261

Merged
merged 3 commits into from
May 13, 2024

Conversation

nsajko
Copy link
Contributor

@nsajko nsajko commented Apr 26, 2024

Fixes #54245

@nsajko nsajko added arrays [a, r, r, a, y, s] bugfix This change fixes an existing bug labels Apr 26, 2024
Copy link
Contributor

@nhz2 nhz2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

base/reshapedarray.jl Outdated Show resolved Hide resolved
In several different situations `reshape` had thrown `DivideError`
instead of returning a correct result or throwing.

Fixes JuliaLang#54245
@nsajko
Copy link
Contributor Author

nsajko commented May 6, 2024

ping

1 similar comment
@nsajko
Copy link
Contributor Author

nsajko commented May 13, 2024

ping

@oscardssmith oscardssmith merged commit b9f68ac into JuliaLang:master May 13, 2024
5 of 7 checks passed
@nsajko nsajko deleted the zerolength_colon_reshape branch May 13, 2024 14:34
@jishnub
Copy link
Contributor

jishnub commented Jun 17, 2024

The type assertions added here appear to have broken reshape using BigInts. Are these essential for type-inference?
E.g. the following works on Julia v1.10, but is broken on nightly:

julia> using FillArrays

julia> reshape(Fill(1, 2), big(2), :)
2×1 Fill{Int64}, with entries equal to 1

Edit: FillArrays appears to directly call this internal function, which it probably shouldn't. However, is reshape necessarily expected to convert indices to Int?

@nsajko
Copy link
Contributor Author

nsajko commented Jun 17, 2024

_reshape_uncolon is only ever (legally) called from that one reshape method, which itself only accepts Union{Int,Colon} dims.

julia/base/reshapedarray.jl

Lines 129 to 130 in b0b7a85

reshape(parent::AbstractArray, dims::Tuple{Vararg{Union{Int,Colon}}}) = reshape(parent, _reshape_uncolon(parent, dims))
@inline function _reshape_uncolon(A, dims)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrays [a, r, r, a, y, s] bugfix This change fixes an existing bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

colonful reshape may spuriously throw DivideError
5 participants