Skip to content

Remove hardcoded offsets for Python 3.14 and 3.15#312

Open
godlygeek wants to merge 1 commit into
bloomberg:mainfrom
godlygeek:drop_hardcoded_offsets_for_3.14+
Open

Remove hardcoded offsets for Python 3.14 and 3.15#312
godlygeek wants to merge 1 commit into
bloomberg:mainfrom
godlygeek:drop_hardcoded_offsets_for_3.14+

Conversation

@godlygeek
Copy link
Copy Markdown
Contributor

These offsets are no longer used for anything in the overwhelming majority of cases. The only way that they could be used is if a process running a modern version of Python managed to trash memory in a way that corrupted the _Py_DebugOffsets structure in memory. And unfortunately, even in that case, we would go on to behave incorrectly: the Python 3.14 debug offsets were wrong.

Since these aren't being used and haven't been being well maintained, and since they're impossible to properly test, and since they're impossible to make work for multiple different interpreter flavors (GIL vs free-threading, JIT vs no-JIT, etc) and they could even change between two patch versions of the interpreter for the same flavor, let's just remove them and turn it into a hard failure if someone manages to trash memory so badly that the _Py_DebugOffsets structure can't be used.

These offsets are no longer used for anything in the overwhelming
majority of cases. The only way that they could be used is if a process
running a modern version of Python managed to trash memory in a way that
corrupted the `_Py_DebugOffsets` structure in memory. And unfortunately,
even in that case, we would go on to behave incorrectly: the Python 3.14
debug offsets were wrong.

Since these aren't being used and haven't been being well maintained,
and since they're impossible to properly test, and since they're
impossible to make work for multiple different interpreter flavors (GIL
vs free-threading, JIT vs no-JIT, etc) and they could even change
between two patch versions of the interpreter for the same flavor, let's
just remove them and turn it into a hard failure if someone manages to
trash memory so badly that the `_Py_DebugOffsets` structure can't be
used.

Signed-off-by: Matt Wozniski <mwozniski@bloomberg.net>
@godlygeek godlygeek requested a review from pablogsal May 28, 2026 04:28
@godlygeek godlygeek self-assigned this May 28, 2026
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 20.00000% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.05%. Comparing base (719948c) to head (0c5c52f).

Files with missing lines Patch % Lines
src/pystack/_pystack/process.cpp 20.00% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #312      +/-   ##
==========================================
- Coverage   79.16%   79.05%   -0.11%     
==========================================
  Files          51       51              
  Lines        5567     5577      +10     
  Branches      584      587       +3     
==========================================
+ Hits         4407     4409       +2     
- Misses       1160     1168       +8     
Flag Coverage Δ
cpp 79.05% <20.00%> (-0.11%) ⬇️
python 79.05% <20.00%> (-0.11%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@godlygeek godlygeek marked this pull request as ready for review May 28, 2026 04:39
@godlygeek godlygeek requested a review from sarahmonod May 28, 2026 04:39
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.

2 participants