Skip to content

Conversation

@adriencaccia
Copy link
Member

@adriencaccia adriencaccia commented Nov 28, 2025

Remove PYTHONMALLOC=malloc which is unsupported for free-threaded builds

Needed for CodSpeedHQ/pytest-codspeed#96 to land

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support for free-threaded Python builds by conditionally setting the PYTHONMALLOC environment variable. Free-threaded Python (with GIL disabled) manages memory differently and does not support PYTHONMALLOC=malloc, so the code now detects this configuration and skips setting the environment variable when appropriate.

Key Changes:

  • Introduced a new helper function to detect free-threaded Python builds via sysconfig.get_config_var('Py_GIL_DISABLED')
  • Modified the measurement setup to conditionally set PYTHONMALLOC=malloc only for non-free-threaded Python

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/run/runner/valgrind/measure.rs Updated to conditionally set PYTHONMALLOC environment variable based on Python build type
src/run/runner/valgrind/helpers/python.rs New module with detection logic for free-threaded Python builds
src/run/runner/valgrind/helpers/mod.rs Added python module export

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@GuillaumeLagrange GuillaumeLagrange left a comment

Choose a reason for hiding this comment

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

lgtm

Remove PYTHONMALLOC=malloc which is unsupported for free-threaded builds
@adriencaccia adriencaccia force-pushed the feat/free-threaded-python branch from 2279f5e to 5954ffa Compare November 28, 2025 16:39
@adriencaccia adriencaccia merged commit 5954ffa into main Nov 28, 2025
6 checks passed
@adriencaccia adriencaccia deleted the feat/free-threaded-python branch November 28, 2025 16:43
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.

3 participants