Skip to content

GH-40153: [Python] Fix OverflowError in foreign_buffer on 32-bit platforms #40158

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

Merged
merged 1 commit into from
Feb 20, 2024

Conversation

mgorny
Copy link
Contributor

@mgorny mgorny commented Feb 20, 2024

Use uintptr_t rather than intptr_t to fix OverflowError, visible e.g. when running tests/interchange/test_conversion.py tests on 32-bit platforms.

Rationale for this change

This fixes the OverflowErrors from #40153, and makes pyarrow/tests/interchange/ all pass on 32-bit x86.

What changes are included in this PR?

  • change the type used to store pointer from intptr_t to uintptr_t to provide coverage for pointers above 0x80000000.

Are these changes tested?

These changes are covered by the tests in pyarrow/tests/interchange.

Are there any user-facing changes?

It fixes OverflowError that can be triggered by working with pandas data types, possibly more (though I'm not sure if this qualifies as a "crash").

…t platforms

Use `uintptr_t` rather than `intptr_t` to fix `OverflowError`, visible
e.g. when running `tests/interchange/test_conversion.py` tests on 32-bit
platforms.
Copy link

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

@mgorny
Copy link
Contributor Author

mgorny commented Feb 20, 2024

Note that this doesn't address all issues from #40153, I've started with the one that seemed to have the biggest impact.

@pitrou
Copy link
Member

pitrou commented Feb 20, 2024

@github-actions crossbow submit -g python -g wheel

Copy link

parse() missing 1 required positional argument: 'config'
The Archery job run can be found at: https://github.com/apache/arrow/actions/runs/7976567301

@pitrou
Copy link
Member

pitrou commented Feb 20, 2024

@github-actions crossbow submit -g python -g wheel

Copy link

Revision: d70772f

Submitted crossbow builds: ursacomputing/crossbow @ actions-9e876b1e47

Task Status
test-conda-python-3.10 GitHub Actions
test-conda-python-3.10-cython2 GitHub Actions
test-conda-python-3.10-hdfs-2.9.2 GitHub Actions
test-conda-python-3.10-hdfs-3.2.1 GitHub Actions
test-conda-python-3.10-pandas-latest GitHub Actions
test-conda-python-3.10-pandas-nightly GitHub Actions
test-conda-python-3.10-spark-v3.5.0 GitHub Actions
test-conda-python-3.10-substrait GitHub Actions
test-conda-python-3.11 GitHub Actions
test-conda-python-3.11-dask-latest GitHub Actions
test-conda-python-3.11-dask-upstream_devel GitHub Actions
test-conda-python-3.11-hypothesis GitHub Actions
test-conda-python-3.11-pandas-upstream_devel GitHub Actions
test-conda-python-3.11-spark-master GitHub Actions
test-conda-python-3.12 GitHub Actions
test-conda-python-3.8 GitHub Actions
test-conda-python-3.8-pandas-1.0 GitHub Actions
test-conda-python-3.8-spark-v3.5.0 GitHub Actions
test-conda-python-3.9 GitHub Actions
test-conda-python-3.9-pandas-latest GitHub Actions
test-cuda-python GitHub Actions
test-debian-11-python-3 Azure
test-fedora-39-python-3 Azure
test-ubuntu-20.04-python-3 Azure
test-ubuntu-22.04-python-3 GitHub Actions
wheel-macos-big-sur-cp310-arm64 GitHub Actions
wheel-macos-big-sur-cp311-arm64 GitHub Actions
wheel-macos-big-sur-cp312-arm64 GitHub Actions
wheel-macos-big-sur-cp38-arm64 GitHub Actions
wheel-macos-big-sur-cp39-arm64 GitHub Actions
wheel-macos-catalina-cp310-amd64 GitHub Actions
wheel-macos-catalina-cp311-amd64 GitHub Actions
wheel-macos-catalina-cp312-amd64 GitHub Actions
wheel-macos-catalina-cp38-amd64 GitHub Actions
wheel-macos-catalina-cp39-amd64 GitHub Actions
wheel-manylinux-2-28-cp310-amd64 GitHub Actions
wheel-manylinux-2-28-cp310-arm64 GitHub Actions
wheel-manylinux-2-28-cp311-amd64 GitHub Actions
wheel-manylinux-2-28-cp311-arm64 GitHub Actions
wheel-manylinux-2-28-cp312-amd64 GitHub Actions
wheel-manylinux-2-28-cp312-arm64 GitHub Actions
wheel-manylinux-2-28-cp38-amd64 GitHub Actions
wheel-manylinux-2-28-cp38-arm64 GitHub Actions
wheel-manylinux-2-28-cp39-amd64 GitHub Actions
wheel-manylinux-2-28-cp39-arm64 GitHub Actions
wheel-manylinux-2014-cp310-amd64 GitHub Actions
wheel-manylinux-2014-cp310-arm64 GitHub Actions
wheel-manylinux-2014-cp311-amd64 GitHub Actions
wheel-manylinux-2014-cp311-arm64 GitHub Actions
wheel-manylinux-2014-cp312-amd64 GitHub Actions
wheel-manylinux-2014-cp312-arm64 GitHub Actions
wheel-manylinux-2014-cp38-amd64 GitHub Actions
wheel-manylinux-2014-cp38-arm64 GitHub Actions
wheel-manylinux-2014-cp39-amd64 GitHub Actions
wheel-manylinux-2014-cp39-arm64 GitHub Actions
wheel-windows-cp310-amd64 GitHub Actions
wheel-windows-cp311-amd64 GitHub Actions
wheel-windows-cp312-amd64 GitHub Actions
wheel-windows-cp38-amd64 GitHub Actions
wheel-windows-cp39-amd64 GitHub Actions

Copy link
Member

@pitrou pitrou left a comment

Choose a reason for hiding this comment

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

Thanks for this @mgorny . This LGTM, I'll just wait for CI to pass.

@github-actions github-actions bot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review labels Feb 20, 2024
@pitrou
Copy link
Member

pitrou commented Feb 20, 2024

CI failures are expected. Will merge.

@pitrou pitrou merged commit 29d2b16 into apache:main Feb 20, 2024
@pitrou pitrou removed the awaiting committer review Awaiting committer review label Feb 20, 2024
Copy link

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

There were no benchmark performance regressions. 🎉

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

zanmato1984 pushed a commit to zanmato1984/arrow that referenced this pull request Feb 28, 2024
…t platforms (apache#40158)

Use `uintptr_t` rather than `intptr_t` to fix `OverflowError`, visible e.g. when running `tests/interchange/test_conversion.py` tests on 32-bit platforms.

### Rationale for this change

This fixes the `OverflowError`s from apache#40153, and makes `pyarrow/tests/interchange/` all pass on 32-bit x86.

### What changes are included in this PR?

- change the type used to store pointer from `intptr_t` to `uintptr_t` to provide coverage for pointers above `0x80000000`.

### Are these changes tested?

These changes are covered by the tests in `pyarrow/tests/interchange`.

### Are there any user-facing changes?

It fixes `OverflowError` that can be triggered by working with pandas data types, possibly more (though I'm not sure if this qualifies as a "crash").

* Closes: apache#40153

Authored-by: Michał Górny <mgorny@gentoo.org>
Signed-off-by: Antoine Pitrou <antoine@python.org>
thisisnic pushed a commit to thisisnic/arrow that referenced this pull request Mar 8, 2024
…t platforms (apache#40158)

Use `uintptr_t` rather than `intptr_t` to fix `OverflowError`, visible e.g. when running `tests/interchange/test_conversion.py` tests on 32-bit platforms.

### Rationale for this change

This fixes the `OverflowError`s from apache#40153, and makes `pyarrow/tests/interchange/` all pass on 32-bit x86.

### What changes are included in this PR?

- change the type used to store pointer from `intptr_t` to `uintptr_t` to provide coverage for pointers above `0x80000000`.

### Are these changes tested?

These changes are covered by the tests in `pyarrow/tests/interchange`.

### Are there any user-facing changes?

It fixes `OverflowError` that can be triggered by working with pandas data types, possibly more (though I'm not sure if this qualifies as a "crash").

* Closes: apache#40153

Authored-by: Michał Górny <mgorny@gentoo.org>
Signed-off-by: Antoine Pitrou <antoine@python.org>
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.

[Python] Test failures on 32-bit x86
2 participants