Skip to content

MINOR: [Python] Array.from_buffers accepts None buffers#49163

Merged
AlenkaF merged 2 commits intoapache:mainfrom
robsdedude:fix/docs/array-from-buffer-none
Mar 5, 2026
Merged

MINOR: [Python] Array.from_buffers accepts None buffers#49163
AlenkaF merged 2 commits intoapache:mainfrom
robsdedude:fix/docs/array-from-buffer-none

Conversation

@robsdedude
Copy link
Contributor

Rationale for this change

Fix the docs. It seems this is a feature and not just happens to work as the code a little below even has an explicit comment:

# None will produce a null buffer pointer

What changes are included in this PR?

Document that Array.from_buffers takes a list[Buffer | None] instead of strictly list[Buffer].

Are these changes tested?

not applicable

Are there any user-facing changes?

Yes, but not in an API sense :)

@github-actions
Copy link

github-actions bot commented Feb 6, 2026

Thanks for opening a pull request!

If this is not a minor PR. Could you open an issue for this pull request on GitHub? https://github.com/apache/arrow/issues/new/choose

Opening GitHub issues ahead of time contributes to the Openness of the Apache Arrow project.

Then could you also rename the pull request title in the following format?

GH-${GITHUB_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}

or

MINOR: [${COMPONENT}] ${SUMMARY}

See also:

@robsdedude
Copy link
Contributor Author

Then could you also rename the pull request title in the following format?

I can in fact not... I think this classifies as a minor change, but I seem to lack permissions to rename my own PR... The button for is isn't showing. Must be a GH thing.

@AlenkaF AlenkaF changed the title Docs: Array.from_buffers accepts None buffers MINOR: [Python]Array.from_buffers accepts None buffers Feb 10, 2026
Copy link
Member

@AlenkaF AlenkaF left a comment

Choose a reason for hiding this comment

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

I think this change is OK and would also update the DictionaryArray method docstrings. cc @raulcd what do you think?

Copy link
Member

@raulcd raulcd left a comment

Choose a reason for hiding this comment

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

This makes sense to me, even though this will probably be reworked as part of the adding type hints initiative that @rok is leading.
@rok does this look good to you?

@robsdedude
Copy link
Contributor Author

I think this change is OK and would also update the DictionaryArray method docstrings.

@AlenkaF would you prefer a separate PR or should I extend this one?

@AlenkaF
Copy link
Member

AlenkaF commented Feb 11, 2026

Please, extend this one.

@github-actions github-actions bot added awaiting committer review Awaiting committer review awaiting merge Awaiting merge and removed awaiting review Awaiting review awaiting committer review Awaiting committer review labels Feb 11, 2026
@robsdedude
Copy link
Contributor Author

Done. While at it, I also saw that RunEndEncodedArray might need updating?

@robsdedude robsdedude changed the title MINOR: [Python]Array.from_buffers accepts None buffers MINOR: [Python] Array.from_buffers accepts None buffers Feb 11, 2026
@robsdedude
Copy link
Contributor Author

@AlenkaF opinions on RunEndEncodedArray?

@AlenkaF
Copy link
Member

AlenkaF commented Mar 5, 2026

@robsdedude I think RunEndEncodedArray is good as is, the buffers there should always be empty, see:

arrow/python/pyarrow/array.pxi

Lines 4403 to 4404 in f2b4e34

RunEndEncodedArrays do not have buffers, only children arrays, but this
implementation is needed to satisfy the Array interface.

and the docstrings are correct there:

Empty List or [None].

@AlenkaF AlenkaF merged commit b095098 into apache:main Mar 5, 2026
16 of 17 checks passed
@AlenkaF AlenkaF removed the awaiting merge Awaiting merge label Mar 5, 2026
@AlenkaF
Copy link
Member

AlenkaF commented Mar 5, 2026

Thanks!

@conbench-apache-arrow
Copy link

After merging your PR, Conbench analyzed the 3 benchmarking runs that have been run so far on merge-commit b095098.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details. It also includes information about 8 possible false positives for unstable benchmarks that are known to sometimes produce them.

@robsdedude robsdedude deleted the fix/docs/array-from-buffer-none branch March 6, 2026 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants