Skip to content

GH-49942: [Python] Protect PyBuffer and NumPyBuffer destructors against interpreter finalization#49943

Open
pitrou wants to merge 1 commit intoapache:mainfrom
pitrou:gh49942-pybuffer-shutdown
Open

GH-49942: [Python] Protect PyBuffer and NumPyBuffer destructors against interpreter finalization#49943
pitrou wants to merge 1 commit intoapache:mainfrom
pitrou:gh49942-pybuffer-shutdown

Conversation

@pitrou
Copy link
Copy Markdown
Member

@pitrou pitrou commented May 6, 2026

Rationale for this change

In #38637 we protected the OwnedRef and OwnedRefNoGIL destructors against being called when the Python interpreter is being finalized, but we didn't address other classes with custom destructors, such as PyBuffer and NumPyBuffer.

What changes are included in this PR?

Avoid executing Python C API code if the interpreter is finalized while a C++ destructor runs.

Are these changes tested?

Only manually, using the initial reproducer in #45214.

Are there any user-facing changes?

No.

@pitrou
Copy link
Copy Markdown
Member Author

pitrou commented May 6, 2026

@github-actions crossbow submit -g python

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

Revision: bbe7634

Submitted crossbow builds: ursacomputing/crossbow @ actions-62ce37605c

Task Status
example-python-minimal-build-fedora-conda GitHub Actions
example-python-minimal-build-ubuntu-venv GitHub Actions
test-conda-python-3.10 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-1.3.4-numpy-1.21.2 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-latest-numpy-latest GitHub Actions
test-conda-python-3.11-spark-master GitHub Actions
test-conda-python-3.12 GitHub Actions
test-conda-python-3.12-cpython-debug GitHub Actions
test-conda-python-3.12-pandas-latest-numpy-1.26 GitHub Actions
test-conda-python-3.12-pandas-latest-numpy-latest GitHub Actions
test-conda-python-3.13 GitHub Actions
test-conda-python-3.13-pandas-nightly-numpy-nightly GitHub Actions
test-conda-python-3.13-pandas-upstream_devel-numpy-nightly GitHub Actions
test-conda-python-3.14 GitHub Actions
test-conda-python-emscripten GitHub Actions
test-debian-13-python-3-amd64 GitHub Actions
test-debian-13-python-3-i386 GitHub Actions
test-fedora-42-python-3 GitHub Actions
test-ubuntu-22.04-python-3 GitHub Actions
test-ubuntu-22.04-python-313-freethreading GitHub Actions
test-ubuntu-24.04-python-3 GitHub Actions

@pitrou
Copy link
Copy Markdown
Member Author

pitrou commented May 6, 2026

@github-actions crossbow submit wheelmac* wheelwin*

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

Revision: bbe7634

Submitted crossbow builds: ursacomputing/crossbow @ actions-62ea8dd650

Task Status
wheel-macos-monterey-cp310-cp310-amd64 GitHub Actions
wheel-macos-monterey-cp310-cp310-arm64 GitHub Actions
wheel-macos-monterey-cp311-cp311-amd64 GitHub Actions
wheel-macos-monterey-cp311-cp311-arm64 GitHub Actions
wheel-macos-monterey-cp312-cp312-amd64 GitHub Actions
wheel-macos-monterey-cp312-cp312-arm64 GitHub Actions
wheel-macos-monterey-cp313-cp313-amd64 GitHub Actions
wheel-macos-monterey-cp313-cp313-arm64 GitHub Actions
wheel-macos-monterey-cp313-cp313t-amd64 GitHub Actions
wheel-macos-monterey-cp313-cp313t-arm64 GitHub Actions
wheel-macos-monterey-cp314-cp314-amd64 GitHub Actions
wheel-macos-monterey-cp314-cp314-arm64 GitHub Actions
wheel-macos-monterey-cp314-cp314t-amd64 GitHub Actions
wheel-macos-monterey-cp314-cp314t-arm64 GitHub Actions
wheel-windows-cp310-cp310-amd64 GitHub Actions
wheel-windows-cp311-cp311-amd64 GitHub Actions
wheel-windows-cp312-cp312-amd64 GitHub Actions
wheel-windows-cp313-cp313-amd64 GitHub Actions
wheel-windows-cp313-cp313t-amd64 GitHub Actions
wheel-windows-cp314-cp314-amd64 GitHub Actions
wheel-windows-cp314-cp314t-amd64 GitHub Actions

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