Skip to content

GH-40319: [Python] Accept null list scalars in pa.array - #53261

Open
nil68657 wants to merge 1 commit into
apache:mainfrom
nil68657:gh-40319-null-list-scalar
Open

nil68657 wants to merge 1 commit into
apache:mainfrom
nil68657:gh-40319-null-list-scalar

Conversation

@nil68657

Copy link
Copy Markdown

Rationale for this change

The list converter treated a pyarrow ListScalar as a Python sequence and
called len() on it, which fails for a null scalar. Append Arrow scalars
directly, as the other converters already do.

What changes are included in this PR?

  • python/pyarrow/src/arrow/python/python_to_arrow.cc

Are these changes tested?

Yes. A regression test in python/pyarrow/tests/test_convert_builtin.py fails without the change and passes with it; the surrounding test module/binary passes.

Are there any user-facing changes?

See the rationale above.

Was AI used for this PR?

This PR is a joint contribution from Nilanjan Chatterjee (@nil68657) and Claude (Claude Opus 5.5, via Claude Code). Nilanjan chose the issue and directed the work; Claude reproduced the bug, wrote the fix, the test and this description.

PR code and description written by:

  • Human
  • AI

Reviewed before submission by:

  • Human
  • AI
  • Not reviewed

The list converter treated a pyarrow ListScalar as a Python sequence and
called len() on it, which fails for a null scalar. Append Arrow scalars
directly, as the other converters already do.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the awaiting review Awaiting review label Oct 11, 2026
@github-actions

Copy link
Copy Markdown

⚠️ GitHub issue #40319 has been automatically assigned in GitHub to PR creator.

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.

1 participant