Skip to content

Clear dim before calling list_flatten()#1239

Merged
DavisVaughan merged 1 commit intotidyverse:mainfrom
DavisVaughan:fix/vctrs-revdeps
Jan 6, 2026
Merged

Clear dim before calling list_flatten()#1239
DavisVaughan merged 1 commit intotidyverse:mainfrom
DavisVaughan:fix/vctrs-revdeps

Conversation

@DavisVaughan
Copy link
Member

We plan to release vctrs on Jan 15, and purrr was an affected revdep.

In vctrs, obj_is_list() no longer reports TRUE for a list array.

This is because most vctrs functions such as list_drop_empty() and list_combine() / list_unchop() validate their input using obj_is_list(), but they aren't well defined on list arrays. In other words when we say "list" in vctrs we really do mean a vector list, not an array list, and size related invariants and C code depend on that definition.

This change has affected array_branch(), since sometimes apply() would return a list array and sometimes it would return a bare list. I think it returns a list array when you apply over >1 dimensions at once, based on looking at the tests.

I am clearing the dim only when it exists, because if you clear the dim on a bare list then it also drops its names, and we have some tests that ensure that we keep names when only going over 1 dimension.

@DavisVaughan
Copy link
Member Author

I feel pretty confident about this fix

@DavisVaughan DavisVaughan merged commit d9bd4fa into tidyverse:main Jan 6, 2026
13 checks passed
@DavisVaughan DavisVaughan deleted the fix/vctrs-revdeps branch January 6, 2026 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant