Compare CPython source code between two Python versions to identify changes in headers and structs. Use this when adding support for a new Python version to understand what changed between versions.
This skill helps compare CPython source code between two Python versions to identify changes in headers, structs, and APIs that affect our codebase.
Use this skill when:
find-cpython-usage skill# Create ~/dd directory if it doesn't exist
mkdir -p ~/dd
# Clone CPython repository if needed (to ~/dd/cpython)
if [ ! -d ~/dd/cpython ]; then
git clone https://github.com/python/cpython.git ~/dd/cpython
cd ~/dd/cpython
git fetch --tags
else
cd ~/dd/cpython
# Update existing repository
git fetch --tags
git fetch origin
fiUsing the list of headers from find-cpython-usage, compare each header between
the old version and new version. Replace OLD_VERSION and NEW_VERSION with the
actual version tags (e.g., v3.13.0, v3.14.0):
# Compare specific headers between versions
git diff OLD_VERSION NEW_VERSION -- Include/internal/pycore_frame.h
git diff OLD_VERSION NEW_VERSION -- Include/frameobject.h
# Compare all internal headers
git diff OLD_VERSION NEW_VERSION -- 'Include/internal/pycore*.h'
# Compare specific struct definitions
git diff OLD_VERSION NEW_VERSION -- Include/internal/pycore_frame.h | grep -A 20 "struct _PyInterpreterFrame"For each header/struct, look for:
Struct Changes:
API Changes:
Header Changes:
For each change identified:
Understand the change:
Why was it changed? (Check Python's What's New, PEPs, or GitHub issues)
Is it a breaking change or backward compatible?
What's the replacement API?
Find the specific commit(s) that introduced the change:
# Find commits that modified a specific file between versions
git log OLD_VERSION..NEW_VERSION -- Include/internal/pycore_frame.h
# Find commits that mention a specific struct or function
git log OLD_VERSION..NEW_VERSION --all --grep="_PyInterpreterFrame" -- Include/
# Show the commit that introduced a specific change
git log -p OLD_VERSION..NEW_VERSION -S "struct _PyInterpreterFrame" -- Include/Find related GitHub issues:
gh-123923, #123923)https://github.com/python/cpython/issueshttps://docs.python.org/3/whatsnew/Assess impact:
Document findings:
You can use AI coding assistants to help analyze differences by:
When comparing versions, look for these types of changes (examples):
Struct Field Changes:
Header Moves:
API Deprecations:
After running this skill, you should have:
5fe261d
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.